libyui-qt
Loading...
Searching...
No Matches
YQDialog.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 Copyright (C) 2022 SUSE LLC
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) version 3.0 of the License. This library
8 is distributed in the hope that it will be useful, but WITHOUT ANY
9 WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 License for more details. You should have received a copy of the GNU
12 Lesser General Public License along with this library; if not, write
13 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14 Floor, Boston, MA 02110-1301 USA
15*/
16
17
18/*-/
19
20 File: YQDialog.h
21
22 Author: Stefan Hundhammer <shundhammer@suse.de>
23
24/-*/
25
26
27#ifndef YQDialog_h
28#define YQDialog_h
29
30#include <QFrame>
31#include <QEvent>
32#include <QWidget>
33#include <QPalette>
34#include <QEvent>
35#include <QCloseEvent>
36
37#include <yui/YDialog.h>
38
39class YQGenericButton;
40class YQWizard;
41class QEventLoop;
42class QTimer;
43class QY2StyleEditor;
44
45
46class YQDialog : public QWidget, public YDialog
47{
48 Q_OBJECT
49
50public:
66 YQDialog( YDialogType dialogType,
67 YDialogColorMode colorMode = YDialogNormalColor );
68
69protected:
70
75 virtual ~YQDialog();
76
77
78public:
79
84 void closeEvent( QCloseEvent * ev );
85
91 virtual void setEnabled( bool enabled );
92
98 virtual int preferredWidth();
99
105 virtual int preferredHeight();
106
112 virtual void setSize( int newWidth, int newHeight );
113
118
122 bool userResized() { return _userResized; }
123
128 YQGenericButton * focusButton() const { return _focusButton; }
129
134 YQGenericButton * defaultButton() const { return _defaultButton; }
135
142 void losingFocus( YQGenericButton * button );
143
150 void gettingFocus( YQGenericButton * button );
151
157 void setDefaultButton( YPushButton * newDefaultButton );
158
163
168 bool activateDefaultButton( bool warn = true );
169
174 YQWizard * findWizard() const;
175
180 YQGenericButton * wizardDefaultButton( YQWizard * wizard ) const;
181
193 virtual void highlight( YWidget * child );
194
202 static void center( QWidget * dialog, QWidget * parent = 0 );
203
207 QEventLoop * eventLoop() { return _eventLoop; }
208
209
216 static QWidget * popupParent();
217
218
219protected slots:
220
224 void waitForEventTimeout();
225
226
227protected:
228
234
240 static QWidget * chooseParent( YDialogType dialogType );
241
246 YQGenericButton * findDefaultButton( YWidgetListConstIterator begin,
247 YWidgetListConstIterator end ) const;
248
253 YQWizard * findWizard( YWidgetListConstIterator begin,
254 YWidgetListConstIterator end ) const;
255
262 YQWizard * ensureOnlyOneDefaultButton( YWidgetListConstIterator begin,
263 YWidgetListConstIterator end );
264
271 virtual void openInternal();
272
278 virtual YEvent * waitForEventInternal( int timeout_millisec );
279
286 virtual YEvent * pollEventInternal();
287
294 virtual void activate();
295
301 virtual void keyPressEvent ( QKeyEvent * event );
302 virtual void focusInEvent ( QFocusEvent * event );
303 virtual void resizeEvent ( QResizeEvent * event );
304
305
306 //
307 // Data members
308 //
309
310 bool _userResized;
311 QSize _userSize;
312
313 YQGenericButton * _focusButton;
314 YQGenericButton * _defaultButton;
315
316 QTimer * _waitForEventTimer;
317 QEventLoop * _eventLoop;
318 YWidget * _highlightedChild;
319 QPalette _preHighlightPalette;
320 bool _preHighlightAutoFill;
321 QY2StyleEditor* _styleEditor;
322
323};
324
325
326#endif // YQDialog_h
327
Stylesheet Editor Dialog.
Definition QY2StyleEditor.h:39
Definition YQDialog.h:47
QEventLoop * eventLoop()
Definition YQDialog.h:207
bool userResized()
Definition YQDialog.h:122
virtual void setSize(int newWidth, int newHeight)
Definition YQDialog.cc:263
virtual int preferredHeight()
Definition YQDialog.cc:224
static QWidget * popupParent()
Definition YQDialog.cc:913
YQGenericButton * defaultButton() const
Definition YQDialog.h:134
YQGenericButton * focusButton() const
Definition YQDialog.h:128
YQWizard * findWizard() const
Definition YQDialog.cc:427
YQGenericButton * findDefaultButton()
Definition YQDialog.cc:299
void gettingFocus(YQGenericButton *button)
Definition YQDialog.cc:591
void ensureOnlyOneDefaultButton()
Definition YQDialog.cc:402
static void center(QWidget *dialog, QWidget *parent=0)
Definition YQDialog.cc:841
void waitForEventTimeout()
Definition YQDialog.cc:827
void toggleAlternateStyleSheet()
Definition YQDialog.cc:894
virtual YEvent * waitForEventInternal(int timeout_millisec)
Definition YQDialog.cc:755
virtual YEvent * pollEventInternal()
Definition YQDialog.cc:805
bool activateDefaultButton(bool warn=true)
Definition YQDialog.cc:536
virtual void activate()
Definition YQDialog.cc:185
virtual int preferredWidth()
Definition YQDialog.cc:193
virtual void openInternal()
Definition YQDialog.cc:175
virtual ~YQDialog()
Definition YQDialog.cc:131
YQGenericButton * wizardDefaultButton(YQWizard *wizard) const
Definition YQDialog.cc:459
virtual void keyPressEvent(QKeyEvent *event)
Definition YQDialog.cc:607
static QWidget * chooseParent(YDialogType dialogType)
Definition YQDialog.cc:156
void setDefaultButton(YPushButton *newDefaultButton)
Definition YQDialog.cc:496
void closeEvent(QCloseEvent *ev)
Definition YQDialog.cc:720
virtual void setEnabled(bool enabled)
Definition YQDialog.cc:255
virtual void highlight(YWidget *child)
Definition YQDialog.cc:856
void losingFocus(YQGenericButton *button)
Definition YQDialog.cc:575
YQDialog(YDialogType dialogType, YDialogColorMode colorMode=YDialogNormalColor)
Definition YQDialog.cc:63
Definition YQGenericButton.h:45
Definition YQWizard.h:64