1 | #include <qobjectlist.h>
|
---|
2 |
|
---|
3 | void WidgetsBase::init()
|
---|
4 | {
|
---|
5 | timeEdit->setTime( QTime::currentTime() );
|
---|
6 | dateEdit->setDate( QDate::currentDate() );
|
---|
7 | }
|
---|
8 |
|
---|
9 | void WidgetsBase::destroy()
|
---|
10 | {
|
---|
11 |
|
---|
12 | }
|
---|
13 |
|
---|
14 | void WidgetsBase::resetColors()
|
---|
15 | {
|
---|
16 | groupBox->setPalette( palette(), FALSE );
|
---|
17 | if(QObjectList *chldn = groupBox->queryList()) {
|
---|
18 | for(QObject *obj=chldn->first(); obj; obj = chldn->next()) {
|
---|
19 | if(obj->isWidgetType()) {
|
---|
20 | QWidget *w = (QWidget *)obj;
|
---|
21 | if(!w->isTopLevel())
|
---|
22 | w->setPalette(palette(), FALSE);
|
---|
23 | }
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | void WidgetsBase::setColor( const QString & color )
|
---|
29 | {
|
---|
30 | groupBox->setPalette( QColor( color ), FALSE );
|
---|
31 | if(QObjectList *chldn = groupBox->queryList()) {
|
---|
32 | for(QObject *obj=chldn->first(); obj; obj = chldn->next()) {
|
---|
33 | if(obj->isWidgetType()) {
|
---|
34 | QWidget *w = (QWidget *)obj;
|
---|
35 | if(!w->isTopLevel())
|
---|
36 | w->setPalette(QColor(color), FALSE);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | void WidgetsBase::setColor()
|
---|
43 | {
|
---|
44 | setColor( lineEdit->text() );
|
---|
45 | }
|
---|
46 |
|
---|
47 | void WidgetsBase::updateClock()
|
---|
48 | {
|
---|
49 | clock->setTime( timeEdit->time() );
|
---|
50 | }
|
---|
51 |
|
---|
52 | void WidgetsBase::updateColorTest( const QString & color )
|
---|
53 | {
|
---|
54 | colorTest->setPalette( QColor( color ) );
|
---|
55 | }
|
---|
56 |
|
---|
57 | void WidgetsBase::updateDateTimeString()
|
---|
58 | {
|
---|
59 | QDateTime dt;
|
---|
60 | dt.setDate( dateEdit->date() );
|
---|
61 | dt.setTime( timeEdit->time() );
|
---|
62 | dateTimeLabel->setText( dt.toString() );
|
---|
63 | }
|
---|
64 |
|
---|