mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Vertically stack the color widget when in dock mode
This commit is contained in:
parent
ce133102bf
commit
cd4bc8887b
@ -14,11 +14,19 @@ class QgsCompoundColorWidget : QgsPanelWidget
|
||||
|
||||
public:
|
||||
|
||||
//! Widget layout
|
||||
enum Layout
|
||||
{
|
||||
LayoutDefault, /*!< Use the default (rectangular) layout */
|
||||
LayoutVertical, /*!< Use a narrower, vertically stacked layout */
|
||||
};
|
||||
|
||||
/** Constructor for QgsCompoundColorWidget
|
||||
* @param parent parent widget
|
||||
* @param color initial color for dialog
|
||||
* @param layout widget layout to use
|
||||
*/
|
||||
QgsCompoundColorWidget( QWidget *parent /TransferThis/ = nullptr, const QColor& color = QColor() );
|
||||
QgsCompoundColorWidget( QWidget *parent /TransferThis/ = nullptr, const QColor& color = QColor(), Layout layout = LayoutDefault );
|
||||
|
||||
~QgsCompoundColorWidget();
|
||||
|
||||
|
@ -96,7 +96,8 @@ void QgsColorButton::showColorDialog()
|
||||
{
|
||||
if ( QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this ) )
|
||||
{
|
||||
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, color() );
|
||||
QgsCompoundColorWidget* colorWidget = new QgsCompoundColorWidget( panel, color(), panel->dockMode() ? QgsCompoundColorWidget::LayoutVertical :
|
||||
QgsCompoundColorWidget::LayoutDefault );
|
||||
colorWidget->setPanelTitle( mColorDialogTitle );
|
||||
colorWidget->setAllowAlpha( mAllowAlpha );
|
||||
connect( colorWidget, SIGNAL( currentColorChanged( QColor ) ), this, SLOT( setValidTemporaryColor( QColor ) ) );
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QMouseEvent>
|
||||
#include <QInputDialog>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
||||
QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& color )
|
||||
QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& color, Layout widgetLayout )
|
||||
: QgsPanelWidget( parent )
|
||||
, mAllowAlpha( true )
|
||||
, mLastCustomColorIndex( 0 )
|
||||
@ -38,6 +38,18 @@ QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& c
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
if ( widgetLayout == LayoutVertical )
|
||||
{
|
||||
// shuffle stuff around
|
||||
QVBoxLayout* newLayout = new QVBoxLayout();
|
||||
newLayout->addWidget( mTabWidget );
|
||||
newLayout->addWidget( mSlidersWidget );
|
||||
newLayout->addWidget( mPreviewWidget );
|
||||
newLayout->addWidget( mSwatchesWidget );
|
||||
delete layout();
|
||||
setLayout( newLayout );
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
|
||||
mSchemeList->header()->hide();
|
||||
|
@ -34,11 +34,19 @@ class GUI_EXPORT QgsCompoundColorWidget : public QgsPanelWidget, private Ui::Qgs
|
||||
|
||||
public:
|
||||
|
||||
//! Widget layout
|
||||
enum Layout
|
||||
{
|
||||
LayoutDefault = 0, /*!< Use the default (rectangular) layout */
|
||||
LayoutVertical, /*!< Use a narrower, vertically stacked layout */
|
||||
};
|
||||
|
||||
/** Constructor for QgsCompoundColorWidget
|
||||
* @param parent parent widget
|
||||
* @param color initial color for dialog
|
||||
* @param layout widget layout to use
|
||||
*/
|
||||
QgsCompoundColorWidget( QWidget *parent = nullptr, const QColor& color = QColor() );
|
||||
QgsCompoundColorWidget( QWidget *parent = nullptr, const QColor& color = QColor(), Layout layout = LayoutDefault );
|
||||
|
||||
~QgsCompoundColorWidget();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user