mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -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:
|
public:
|
||||||
|
|
||||||
|
//! Widget layout
|
||||||
|
enum Layout
|
||||||
|
{
|
||||||
|
LayoutDefault, /*!< Use the default (rectangular) layout */
|
||||||
|
LayoutVertical, /*!< Use a narrower, vertically stacked layout */
|
||||||
|
};
|
||||||
|
|
||||||
/** Constructor for QgsCompoundColorWidget
|
/** Constructor for QgsCompoundColorWidget
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
* @param color initial color for dialog
|
* @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();
|
~QgsCompoundColorWidget();
|
||||||
|
|
||||||
|
@ -96,7 +96,8 @@ void QgsColorButton::showColorDialog()
|
|||||||
{
|
{
|
||||||
if ( QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this ) )
|
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->setPanelTitle( mColorDialogTitle );
|
||||||
colorWidget->setAllowAlpha( mAllowAlpha );
|
colorWidget->setAllowAlpha( mAllowAlpha );
|
||||||
connect( colorWidget, SIGNAL( currentColorChanged( QColor ) ), this, SLOT( setValidTemporaryColor( QColor ) ) );
|
connect( colorWidget, SIGNAL( currentColorChanged( QColor ) ), this, SLOT( setValidTemporaryColor( QColor ) ) );
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& color, Layout widgetLayout )
|
||||||
QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& color )
|
|
||||||
: QgsPanelWidget( parent )
|
: QgsPanelWidget( parent )
|
||||||
, mAllowAlpha( true )
|
, mAllowAlpha( true )
|
||||||
, mLastCustomColorIndex( 0 )
|
, mLastCustomColorIndex( 0 )
|
||||||
@ -38,6 +38,18 @@ QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& c
|
|||||||
{
|
{
|
||||||
setupUi( this );
|
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;
|
QSettings settings;
|
||||||
|
|
||||||
mSchemeList->header()->hide();
|
mSchemeList->header()->hide();
|
||||||
|
@ -34,11 +34,19 @@ class GUI_EXPORT QgsCompoundColorWidget : public QgsPanelWidget, private Ui::Qgs
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//! Widget layout
|
||||||
|
enum Layout
|
||||||
|
{
|
||||||
|
LayoutDefault = 0, /*!< Use the default (rectangular) layout */
|
||||||
|
LayoutVertical, /*!< Use a narrower, vertically stacked layout */
|
||||||
|
};
|
||||||
|
|
||||||
/** Constructor for QgsCompoundColorWidget
|
/** Constructor for QgsCompoundColorWidget
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
* @param color initial color for dialog
|
* @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();
|
~QgsCompoundColorWidget();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user