wf | WStyle_NormalBorder | WStyle_Customize | WStyle_Title | WStyle_SysMenu ),
#endif
mySender( 0 ),
+myAlignment( 0 ),
myInited( false ),
-myDialogFlags( Accept ),
-myAlignment( 0 )
+myDialogFlags( Accept | SetFocus )
{
QVBoxLayout* base = new QVBoxLayout( this, 5, 0 );
QtxGroupBox* main = new QtxGroupBox( 1, Qt::Horizontal, "", this );
Following flags can be used:
Accept - Allow to control dialog accepting. See also acceptData().
Reject - Allow to control dialog rejecting. See also rejectData().
- AlignOnce - Allow to align dialog only whem it first time shown.
+ AlignOnce - Allow to align dialog only when it first time shown.
+ SetFocus - Allow to set focus on dialog when it shown. User can use
+ setFocusProxy() and specify own initial focus widget.
*/
void QtxDialog::setDialogFlags( const int f )
{
QDialog::show();
- setFocus();
+ if ( testDialogFlags( SetFocus ) )
+ setFocus();
+
myInited = true;
}
{
Q_OBJECT
- class Area;
- class Border;
+ class Area;
+ class Border;
public:
typedef enum { Position, Expand, Uniform } PlacePolicy;
All = Standard | YesNo | Apply | Close } ButtonFlags;
typedef enum { Accept = 0x000001,
- Reject = 0x000002,
- AlignOnce = 0x000004 } DialogFlags;
+ Reject = 0x000002,
+ AlignOnce = 0x000004,
+ SetFocus = 0x000008 } DialogFlags;
public:
QtxDialog( QWidget* = 0, const char* = 0, bool = false,
bool = false, const int = Standard, WFlags = 0 );
virtual ~QtxDialog();
-
+
void setDialogFlags( const int );
void clearDialogFlags( const int );
bool testDialogFlags( const int ) const;
-
+
void setButtonFlags( const int );
void clearButtonFlags( const int );
bool testButtonFlags( const int ) const;
-
+
int buttonPosition( const int ) const;
void setButtonPosition( const int, const int = -1 );
void setPlacePosition( const int, const int );
-
+
int placePolicy( const int ) const;
void setPlacePolicy( const int, const int );
void setButtonPlace( const int, const int );
-
+
QString buttonText( const int );
void setButtonText( const int, const QString& text );
-
+
void setButtonFocus( const int );
bool hasButtonFocus( const int ) const;
-
+
bool isButtonEnabled( const int ) const;
void setButtonEnabled( const bool, const int );
-
+
bool isBorderEnabled( const int ) const;
void setBorderEnabled( const bool, const int );
-
+
void removeButton( const int );
int insertButton( const QString&, const int = BottomArea );
-
+
QValueList<int> userButtonIds() const;
QButton* userButton( const int ) const;
-
+
virtual void show();
virtual void hide();
-
+
uint setAlignment( uint align );
static void setUnits( QLabel*, const QString& );
-
+
signals:
void dlgButton( int );
void dlgParamChanged();
-
+
void dlgHelp();
void dlgApply();
-
+
void dlgOk();
void dlgNo();
void dlgYes();
void dlgClose();
void dlgCancel();
-
+
public slots:
void update();
void onButton();
void onSizeGripDestroyed();
void onDestroyed( QObject* );
-
+
protected:
typedef QMap<int, QButton*> ButtonMap;
-
+
protected:
QFrame* mainFrame() const;
-
+
virtual bool acceptData() const;
virtual bool rejectData() const;
-
+
virtual QButton* createButton( QWidget* );
-
+
QButton* button( const int ) const;
ButtonMap buttons( const int = All ) const;
int buttonId( const QButton* ) const;
int buttonPosition( QButton* ) const;
-
+
virtual void showEvent( QShowEvent* );
virtual void hideEvent( QHideEvent* );
virtual void closeEvent( QCloseEvent* );
virtual void childEvent( QChildEvent* );
virtual void keyPressEvent( QKeyEvent* );
-
+
private:
- void adjustButtons();
+ void adjustButtons();
void emitSignal();
-
+
private:
typedef QMap<int, Area*> AreaMap;
typedef QMap<int, int> PositionMap;
-
+
friend class Area;
-
+
private:
AreaMap myArea;
ButtonMap myButton;
PositionMap myPosition;
-
+
bool myInited;
const QObject* mySender;
uint myAlignment;