mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Dynamically set number of columns to show in character widget
based on widget width, and avoid unnecessary horizontal scroll bar
This commit is contained in:
parent
ffe02c37b6
commit
243acb328f
@ -128,6 +128,8 @@ Emitted when a character is selected in the widget.
|
||||
|
||||
virtual void paintEvent( QPaintEvent *event );
|
||||
|
||||
virtual void resizeEvent( QResizeEvent *event );
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
#include "qgsscrollarea.h"
|
||||
#include <QScrollBar>
|
||||
|
||||
// milliseconds to swallow child wheel events for after a scroll occurs
|
||||
#define TIMEOUT 1000
|
||||
|
@ -256,3 +256,9 @@ void CharacterWidget::paintEvent( QPaintEvent *event )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterWidget::resizeEvent( QResizeEvent *event )
|
||||
{
|
||||
mColumns = event->size().width() / mSquareSize;
|
||||
QWidget::resizeEvent( event );
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ class GUI_EXPORT CharacterWidget : public QWidget
|
||||
void mouseMoveEvent( QMouseEvent *event ) override;
|
||||
void mousePressEvent( QMouseEvent *event ) override;
|
||||
void paintEvent( QPaintEvent *event ) override;
|
||||
void resizeEvent( QResizeEvent *event ) override;
|
||||
|
||||
private:
|
||||
QFont mDisplayFont;
|
||||
|
@ -3253,6 +3253,7 @@ QgsFontMarkerSymbolLayerWidget::QgsFontMarkerSymbolLayerWidget( QgsVectorLayer *
|
||||
|
||||
widgetChar = new CharacterWidget();
|
||||
scrollArea->setWidget( widgetChar );
|
||||
scrollArea->setVerticalOnly( true );
|
||||
|
||||
btnColor->setAllowOpacity( true );
|
||||
btnColor->setColorDialogTitle( tr( "Select Symbol Fill Color" ) );
|
||||
|
@ -360,7 +360,7 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user