Skip to content
Permalink
Browse files

Update to new style side bar style for dialogs.

	- New blue-grey with white text style dialog
	- Side panel runs top to bottom
	- Icon size is read from settings
	- Option to disable in options dialog
  • Loading branch information
NathanW2 committed Jan 6, 2014
1 parent 305a42a commit 740024ca1e93703469c7ef25ed81c709bcc85238
@@ -92,6 +92,8 @@ QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions()
bool gbxBoldTitle = false;
opts.insert( "groupBoxBoldTitle", settings.value( "groupBoxBoldTitle", QVariant( gbxBoldTitle ) ) );

opts.insert( "sidebarStyle", settings.value( "sidebarStyle", true ) );

settings.endGroup(); // "qgis/stylesheet"

return opts;
@@ -118,6 +120,7 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )
QgsDebugMsg( QString( "groupBoxCustom: %1" ).arg( gbxCustom ) );
bool gbxBoldTitle = opts.value( "groupBoxBoldTitle" ).toBool();
QgsDebugMsg( QString( "groupBoxBoldTitle: %1" ).arg( gbxBoldTitle ) );
bool sidebar = opts.value( "sidebarStyle" ).toBool();
if ( gbxCustom || gbxBoldTitle )
{
ss += "QGroupBox{";
@@ -156,6 +159,23 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )
}
}

if ( sidebar )
{
QString style = "QListWidget#mOptionsListWidget {"
"background-color: rgb(162, 170, 179);"
"}"
"QListWidget#mOptionsListWidget::item {"
" color: white;"
" padding: 3px;"
"}"
"QListWidget#mOptionsListWidget::item::selected {"
" color: black;"
" background-color:palette(Window);"
" padding-right: 0px; "
"}";
ss += style;
}

//fix background issue for gnome desktop
if ( mLinuxOS && mGtkStyle )
{
@@ -31,13 +31,14 @@ std::map<QString, QPixmap> mugs;
*/
#ifdef Q_OS_MACX
QgsAbout::QgsAbout( QWidget *parent )
: QDialog( parent, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
: QgsOptionsDialogBase( parent, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
#else
QgsAbout::QgsAbout( QWidget *parent )
: QDialog( parent ) // Normal dialog in non Mac-OS
: QgsOptionsDialogBase( "about", parent ) // Normal dialog in non Mac-OS
#endif
{
setupUi( this );
initOptionsBase();
init();
}

@@ -18,8 +18,9 @@
#define QGSABOUT_H

#include "ui_qgsabout.h"
#include "qgsoptionsdialogbase.h"

class APP_EXPORT QgsAbout : public QDialog, private Ui::QgsAbout
class APP_EXPORT QgsAbout : public QgsOptionsDialogBase , private Ui::QgsAbout
{
Q_OBJECT
public:
@@ -546,6 +546,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :

// custom group boxes
mCustomGroupBoxChkBx->setChecked( mStyleSheetOldOpts.value( "groupBoxCustom" ).toBool() );
mCustomSideBarSide->setChecked( mStyleSheetOldOpts.value( "sidebarStyle" ).toBool() );
mBoldGroupBoxTitleChkBx->setChecked( mStyleSheetOldOpts.value( "groupBoxBoldTitle" ).toBool() );

mMessageTimeoutSpnBx->setValue( settings.value( "/qgis/messageTimeout", 5 ).toInt() );
@@ -1412,6 +1413,12 @@ void QgsOptions::on_mCustomGroupBoxChkBx_clicked( bool chkd )
mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts );
}

void QgsOptions::on_mCustomSideBarSide_clicked( bool chkd )
{
mStyleSheetNewOpts.insert( "sidebarStyle", chkd );
mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts );
}

void QgsOptions::on_mBoldGroupBoxTitleChkBx_clicked( bool chkd )
{
mStyleSheetNewOpts.insert( "groupBoxBoldTitle", QVariant( chkd ) );
@@ -129,6 +129,11 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
*/
void on_mCustomGroupBoxChkBx_clicked( bool chkd );

/** Slot to set whether to use custom side bar style
* @note added in QGIS 2.2
*/
void on_mCustomSideBarSide_clicked( bool chkd );

/** Slot to set whether to bold group box titles
* @note added in QGIS 1.9
*/
@@ -49,19 +49,40 @@ void QgsOptionsDialogBase::initOptionsBase( bool restoreUi )
// don't add to dialog margins
// redefine now, or those in inherited .ui file will be added
if ( layout() )
layout()->setContentsMargins( 12, 12, 12, 12 ); // Qt default spacing
{
layout()->setContentsMargins( 0, 0, 0, 0 ); // Qt default spacing
}

// start with copy of qgsoptionsdialog_template.ui to ensure existence of these objects
mOptListWidget = findChild<QListWidget*>( "mOptionsListWidget" );
QFrame* optionsFrame = findChild<QFrame*>("mOptionsFrame");
mOptStackedWidget = findChild<QStackedWidget*>( "mOptionsStackedWidget" );
mOptSplitter = findChild<QSplitter*>( "mOptionsSplitter" );
mOptButtonBox = findChild<QDialogButtonBox*>( "buttonBox" );
QFrame* buttonBoxFrame = findChild<QFrame*>("mButtonBoxFrame");

if ( !mOptListWidget || !mOptStackedWidget || !mOptSplitter )
if ( !mOptListWidget || !mOptStackedWidget || !mOptSplitter || !optionsFrame )
{
return;
}

QSettings settings;
int size = settings.value( "/IconSize", 24 ).toInt();
mOptListWidget->setIconSize( QSize(size, size) );

optionsFrame->layout()->setContentsMargins(0,3,3,3);
QVBoxLayout* layout = static_cast<QVBoxLayout*>(optionsFrame->layout());

if ( buttonBoxFrame )
{
buttonBoxFrame->layout()->setContentsMargins(0,0,0,0);
layout->insertWidget(layout->count() + 1, buttonBoxFrame );
}
else
{
layout->insertWidget( layout->count() + 1, mOptButtonBox );
}

if ( mOptButtonBox )
{
// enforce only one connection per signal, in case added in Qt Designer

0 comments on commit 740024c

Please sign in to comment.
You can’t perform that action at this time.