summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Mihalache <[email protected]>2015-04-04 17:11:06 +0200
committerTorsten Rahn <[email protected]>2015-04-04 17:11:06 +0200
commitbe1205b6bacd4de60bd731a259d3f9d7e03bd32a (patch)
treec427e752dd20b5395aa41627263d20a55ad38fdc
parent7bc5ef09ffcaae5deead346430af3b0cda48731c (diff)
FormattedTextWidget: textColorButton fix.
- The textColorButton didn't behave like the other buttons surrounding it (if the window is resized, this does not enter the dropdown list). - Resized EditPlacemarkDialog window a bit :) REVIEW: 123252
-rw-r--r--src/lib/marble/EditPlacemarkDialog.ui2
-rw-r--r--src/lib/marble/FormattedTextWidget.cpp27
-rw-r--r--src/lib/marble/FormattedTextWidget.ui6
3 files changed, 17 insertions, 18 deletions
diff --git a/src/lib/marble/EditPlacemarkDialog.ui b/src/lib/marble/EditPlacemarkDialog.ui
index b40c7ac..a1ba027 100644
--- a/src/lib/marble/EditPlacemarkDialog.ui
+++ b/src/lib/marble/EditPlacemarkDialog.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>636</width>
+ <width>677</width>
<height>372</height>
</rect>
</property>
diff --git a/src/lib/marble/FormattedTextWidget.cpp b/src/lib/marble/FormattedTextWidget.cpp
index 1da3813..0b6c1f9 100644
--- a/src/lib/marble/FormattedTextWidget.cpp
+++ b/src/lib/marble/FormattedTextWidget.cpp
@@ -38,13 +38,11 @@ public:
~Private();
QColorDialog *m_textColorDialog;
- QPushButton *m_textColorButton;
};
FormattedTextWidget::Private::Private() :
Ui::FormattedTextWidget(),
- m_textColorDialog( 0 ),
- m_textColorButton( new QPushButton )
+ m_textColorDialog( 0 )
{
//nothing to do
}
@@ -52,7 +50,6 @@ FormattedTextWidget::Private::Private() :
FormattedTextWidget::Private::~Private()
{
delete m_textColorDialog;
- delete m_textColorButton;
}
FormattedTextWidget::FormattedTextWidget( QWidget *parent ) :
@@ -61,13 +58,10 @@ FormattedTextWidget::FormattedTextWidget( QWidget *parent ) :
{
d->setupUi( this );
- QAction *separator = d->m_formattedTextToolBar->insertSeparator( d->m_actionAddImage );
- d->m_formattedTextToolBar->insertWidget( separator, d->m_textColorButton );
- d->m_textColorButton->setMaximumSize( 24, 24 );
- QPixmap textColorPixmap( d->m_textColorButton->iconSize().width(),
- d->m_textColorButton->iconSize().height() );
+ d->m_formattedTextToolBar->insertSeparator( d->m_actionAddImage );
+ QPixmap textColorPixmap(20, 20);
textColorPixmap.fill( d->m_description->textCursor().charFormat().foreground().color() );
- d->m_textColorButton->setIcon( QIcon( textColorPixmap ) );
+ d->m_actionColor->setIcon( textColorPixmap );
d->m_textColorDialog = new QColorDialog( this );
d->m_textColorDialog->setOption( QColorDialog::ShowAlphaChannel );
d->m_textColorDialog->setCurrentColor( d->m_description->textCursor().charFormat().foreground().color() );
@@ -78,7 +72,7 @@ FormattedTextWidget::FormattedTextWidget( QWidget *parent ) :
} else {
d->m_fontSize->lineEdit()->setText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) );
}
- connect( d->m_textColorButton, SIGNAL( clicked() ), d->m_textColorDialog, SLOT( exec() ) );
+ connect( d->m_actionColor, SIGNAL( triggered() ), d->m_textColorDialog, SLOT( exec() ) );
connect( d->m_textColorDialog, SIGNAL( colorSelected( QColor ) ), this, SLOT( setTextCursorColor( const QColor& ) ) );
connect( d->m_isFormattedTextMode, SIGNAL( toggled( bool ) ), this, SLOT( toggleDescriptionEditMode( bool ) ) );
connect( d->m_fontFamily, SIGNAL( currentFontChanged( QFont ) ), this, SLOT( setTextCursorFont( QFont ) ) );
@@ -162,10 +156,9 @@ void FormattedTextWidget::setTextCursorColor( const QColor &color )
format.setForeground( brush );
cursor.mergeCharFormat( format );
d->m_description->setTextCursor( cursor );
- QPixmap textColorPixmap( d->m_textColorButton->iconSize().width(),
- d->m_textColorButton->iconSize().height() );
+ QPixmap textColorPixmap(22, 22);
textColorPixmap.fill( format.foreground().color() );
- d->m_textColorButton->setIcon( QIcon( textColorPixmap ) );
+ d->m_actionColor->setIcon( QIcon( textColorPixmap ) );
d->m_textColorDialog->setCurrentColor( format.foreground().color() );
}
@@ -239,10 +232,9 @@ void FormattedTextWidget::updateDescriptionEditButtons()
d->m_actionItalics->setChecked( format.fontItalic() );
d->m_actionUnderlined->setChecked( format.fontUnderline() );
- QPixmap textColorPixmap( d->m_textColorButton->iconSize().width(),
- d->m_textColorButton->iconSize().height() );
+ QPixmap textColorPixmap(22, 22);
textColorPixmap.fill( format.foreground().color() );
- d->m_textColorButton->setIcon( QIcon( textColorPixmap ) );
+ d->m_actionColor->setIcon( QIcon( textColorPixmap ) );
d->m_textColorDialog->setCurrentColor( format.foreground().color() );
int index = d->m_fontSize->findText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) );
@@ -264,6 +256,7 @@ void FormattedTextWidget::setReadOnly( bool state )
d->m_formattedTextToolBar->setDisabled( state );
d->m_fontFamily->setDisabled( state );
d->m_fontSize->setDisabled( state );
+ d->m_actionColor->setDisabled( state );
}
}
diff --git a/src/lib/marble/FormattedTextWidget.ui b/src/lib/marble/FormattedTextWidget.ui
index 2082275..c145f53 100644
--- a/src/lib/marble/FormattedTextWidget.ui
+++ b/src/lib/marble/FormattedTextWidget.ui
@@ -151,6 +151,7 @@
<addaction name="m_actionBold"/>
<addaction name="m_actionItalics"/>
<addaction name="m_actionUnderlined"/>
+ <addaction name="m_actionColor"/>
<addaction name="m_actionAddImage"/>
<addaction name="m_actionAddLink"/>
</widget>
@@ -246,6 +247,11 @@
<string>Add link</string>
</property>
</action>
+ <action name="m_actionColor">
+ <property name="text">
+ <string>Color</string>
+ </property>
+ </action>
</widget>
<resources>
<include location="libmarble.qrc"/>