9
9
#include < QFileDialog>
10
10
#include < QSettings>
11
11
12
+
13
+ // this widget class will go into its separate file
14
+
15
+ // #include <QMouseEvent>
16
+ // #include <QStyleOptionGroupBox>
17
+ // #include <QStylePainter>
18
+
19
+ GroupBox::GroupBox ( QWidget *parent )
20
+ : QGroupBox( parent ), m_collapsed( false )
21
+ {
22
+ connect ( this , SIGNAL ( toggled ( bool ) ), this , SLOT ( setToggled ( bool ) ) );
23
+ // setToggled( isChecked() );
24
+ }
25
+
26
+ GroupBox::GroupBox ( const QString &title, QWidget *parent )
27
+ : QGroupBox(title, parent ), m_collapsed( false )
28
+ {}
29
+
30
+ bool GroupBox::isCollapsed () { return m_collapsed; }
31
+
32
+ // void GroupBox::mousePressEvent( QMouseEvent *e )
33
+ // {
34
+ // QgsDebugMsg("press event");
35
+ // if( e->button() == Qt::LeftButton )
36
+ // {
37
+ // QgsDebugMsg("left but");
38
+ // QStyleOptionGroupBox option;
39
+ // initStyleOption( &option );
40
+ // QRect buttonArea( 0, 0, 16, 16 );
41
+ // buttonArea.moveTopRight( option.rect.adjusted( 0, 0, -10, 0
42
+ // ).topRight() );
43
+ // if( buttonArea.contains( e->pos() ) )
44
+ // {
45
+ // clickPos = e->pos();
46
+ // return;
47
+ // }
48
+ // }
49
+ // QGroupBox::mousePressEvent( e );
50
+ // }
51
+
52
+ // void GroupBox::mouseReleaseEvent( QMouseEvent *e )
53
+ // {
54
+ // QgsDebugMsg("release");
55
+ // if( e->button() == Qt::LeftButton && clickPos == e->pos() )
56
+ // setCollapse( !isCollapsed() );
57
+ // }
58
+
59
+ // void GroupBox::paintEvent( QPaintEvent * )
60
+ // {
61
+ // QgsDebugMsg("paint event");
62
+
63
+ // QStylePainter paint( this );
64
+ // QStyleOptionGroupBox option;
65
+ // initStyleOption( &option );
66
+ // paint.drawComplexControl( QStyle::CC_GroupBox, option );
67
+ // paint.drawItemPixmap(
68
+ // option.rect.adjusted( 0, 0, -10, 0 ),
69
+ // Qt::AlignTop | Qt::AlignRight,
70
+ // QPixmap( m_collapsed ?
71
+ // ":/images/images/navigate_down2_16x16.png" :
72
+ // ":/images/images/navigate_up2_16x16.png" ) );
73
+ // }
74
+
75
+ void GroupBox::showEvent ( QShowEvent * event )
76
+ {
77
+ // QgsDebugMsg(QString("%1 showEvent %2 %3").arg(objectName()).arg(isChecked()).arg(isCollapsed()));
78
+ QGroupBox::showEvent ( event );
79
+ if ( ! isChecked () && ! isCollapsed () )
80
+ setCollapsed ( true );
81
+ }
82
+
83
+ void GroupBox::setCollapsed ( bool collapse )
84
+ {
85
+ if ( ! isVisible () )
86
+ return ;
87
+ // QgsDebugMsg(QString("%1 setcollapse %2").arg(objectName()).arg(collapse));
88
+
89
+ // minimize layout margins, restore later
90
+ if ( collapse )
91
+ {
92
+ if ( layout () )
93
+ {
94
+ margins = layout ()->contentsMargins ();
95
+ layout ()->setContentsMargins (1 ,1 ,1 ,1 );
96
+ }
97
+ }
98
+ else
99
+ {
100
+ if ( layout () )
101
+ {
102
+ layout ()->setContentsMargins ( margins );
103
+ }
104
+ }
105
+ m_collapsed = collapse;
106
+ foreach ( QWidget *widget, findChildren<QWidget*>() )
107
+ widget->setHidden ( collapse );
108
+
109
+ if ( m_collapsed )
110
+ emit collapsed ( this );
111
+ else
112
+ emit expanded ( this );
113
+ }
114
+
12
115
QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog ( QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent,
13
116
const QgsCoordinateReferenceSystem& layerCrs,
14
117
const QgsCoordinateReferenceSystem& currentCrs,
@@ -26,7 +129,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* s
26
129
mLoadTransparentNoDataToolButton ->setIcon ( QgsApplication::getThemeIcon ( " /mActionCopySelected.png" ) );
27
130
mRemoveSelectedNoDataToolButton ->setIcon ( QgsApplication::getThemeIcon ( " /mActionDeleteAttribute.png" ) );
28
131
mRemoveAllNoDataToolButton ->setIcon ( QgsApplication::getThemeIcon ( " /mActionRemove.png" ) );
29
- mNoDataGroupBox ->setEnabled ( false ); // not yet implemented
132
+ // mNoDataGroupBox->setEnabled( false ); // not yet implemented
30
133
31
134
setValidators ();
32
135
// Translated labels + EPSG are updated later
@@ -81,6 +184,12 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* s
81
184
{
82
185
okButton->setEnabled ( false );
83
186
}
187
+
188
+ // this should scroll down to make widget visible, but it's not happening
189
+ // (at least part of it is visible)...
190
+ connect ( mCreateOptionsGroupBox , SIGNAL ( expanded ( QWidget* ) ),
191
+ this , SLOT ( groupBoxExpanded ( QWidget* ) ) );
192
+
84
193
}
85
194
86
195
void QgsRasterLayerSaveAsDialog::setValidators ()
0 commit comments