Skip to content

Commit

Permalink
Enable help button and title in color dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ committed Dec 9, 2017
1 parent 297138f commit 9956864
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/gui/qgscolorbrewercolorrampdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,17 @@ QgsColorBrewerColorRampDialog::QgsColorBrewerColorRampDialog( const QgsColorBrew
QVBoxLayout *vLayout = new QVBoxLayout();
mWidget = new QgsColorBrewerColorRampWidget( ramp );
vLayout->addWidget( mWidget );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
connect( bbox, &QDialogButtonBox::accepted, this, &QDialog::accept );
connect( bbox, &QDialogButtonBox::rejected, this, &QDialog::reject );
connect( bbox, &QDialogButtonBox::helpRequested, this, &QgsColorBrewerColorRampDialog::showHelp );
vLayout->addWidget( bbox );
setLayout( vLayout );
setWindowTitle( tr( "ColorBrewer Ramp" ) );
connect( mWidget, &QgsColorBrewerColorRampWidget::changed, this, &QgsColorBrewerColorRampDialog::changed );
}

void QgsColorBrewerColorRampDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "working_with_vector/style_library.html#color-ramp" ) );
}
5 changes: 5 additions & 0 deletions src/gui/qgscolorbrewercolorrampdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <QDialog>
#include "qgspanelwidget.h"
#include "qgscolorramp.h"
#include "qgshelp.h"
#include "ui_qgscolorbrewercolorrampwidgetbase.h"
#include "qgis_gui.h"
#include "qgis.h"
Expand Down Expand Up @@ -118,6 +119,10 @@ class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog

QgsColorBrewerColorRampWidget *mWidget = nullptr;

private slots:

void showHelp();

};

#endif
9 changes: 8 additions & 1 deletion src/gui/qgslimitedrandomcolorrampdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,17 @@ QgsLimitedRandomColorRampDialog::QgsLimitedRandomColorRampDialog( const QgsLimit
QVBoxLayout *vLayout = new QVBoxLayout();
mWidget = new QgsLimitedRandomColorRampWidget( ramp );
vLayout->addWidget( mWidget );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
connect( bbox, &QDialogButtonBox::accepted, this, &QDialog::accept );
connect( bbox, &QDialogButtonBox::rejected, this, &QDialog::reject );
connect( bbox, &QDialogButtonBox::helpRequested, this, &QgsLimitedRandomColorRampDialog::showHelp );
vLayout->addWidget( bbox );
setLayout( vLayout );
setWindowTitle( tr( "Random Color Ramp" ) );
connect( mWidget, &QgsLimitedRandomColorRampWidget::changed, this, &QgsLimitedRandomColorRampDialog::changed );
}

void QgsLimitedRandomColorRampDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "working_with_vector/style_library.html#color-ramp" ) );
}
5 changes: 5 additions & 0 deletions src/gui/qgslimitedrandomcolorrampdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "qgis.h"
#include "qgspanelwidget.h"
#include "qgscolorramp.h"
#include "qgshelp.h"
#include "ui_qgslimitedrandomcolorrampwidgetbase.h"
#include "qgis_gui.h"

Expand Down Expand Up @@ -129,6 +130,10 @@ class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog

QgsLimitedRandomColorRampWidget *mWidget = nullptr;

private slots:

void showHelp();

};

#endif
9 changes: 8 additions & 1 deletion src/gui/qgspresetcolorrampdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,17 @@ QgsPresetColorRampDialog::QgsPresetColorRampDialog( const QgsPresetSchemeColorRa
QVBoxLayout *vLayout = new QVBoxLayout();
mWidget = new QgsPresetColorRampWidget( ramp );
vLayout->addWidget( mWidget );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
connect( bbox, &QDialogButtonBox::accepted, this, &QDialog::accept );
connect( bbox, &QDialogButtonBox::rejected, this, &QDialog::reject );
connect( bbox, &QDialogButtonBox::helpRequested, this, &QgsPresetColorRampDialog::showHelp );
vLayout->addWidget( bbox );
setLayout( vLayout );
setWindowTitle( tr( "Color Presets Ramp" ) );
connect( mWidget, &QgsPresetColorRampWidget::changed, this, &QgsPresetColorRampDialog::changed );
}

void QgsPresetColorRampDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "working_with_vector/style_library.html#color-ramp" ) );
}
5 changes: 5 additions & 0 deletions src/gui/qgspresetcolorrampdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "qgis.h"
#include "qgspanelwidget.h"
#include "qgscolorramp.h"
#include "qgshelp.h"
#include "ui_qgspresetcolorrampwidgetbase.h"
#include "qgis_gui.h"

Expand Down Expand Up @@ -117,6 +118,10 @@ class GUI_EXPORT QgsPresetColorRampDialog : public QDialog

QgsPresetColorRampWidget *mWidget = nullptr;

private slots:

void showHelp();

};

#endif //QGSPRESETCOLORRAMPDIALOG_H
1 change: 1 addition & 0 deletions src/gui/symbology/qgscptcitycolorrampdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ void QgsCptCityColorRampDialog::showHelp()
"(you must enable Experimental plugins in the plugin manager).\n\n"
);
QMessageBox *msg = new QMessageBox( this );
msg->setWindowTitle( tr( "Download more cpt-city Gradients" ) );
msg->setText( helpText );
msg->exec();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgspresetcolorrampwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>ColorBrewer Ramp</string>
<string>Color Presets Ramp</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,0">
<item>
Expand Down

0 comments on commit 9956864

Please sign in to comment.