3 #include <kapplication.h>
4 #include <kcmdlineargs.h>
5 #include <kiconloader.h>
7 #include <QtGui/QImage>
8 #include <QtCore/QString>
10 DockTest::DockTest( QWidget
* parent
)
11 : K3DockArea( parent
)
13 m_blueDock
= createDockWidget( "Blue Widget", SmallIcon("internet-mail") );
14 //m_blueDock->setDetachable( false );
15 m_blueDock
->setEnableDocking( K3DockWidget::DockFullSite
);
16 K3DockWidgetHeader
*header
= new K3DockWidgetHeader( m_blueDock
, "Blue Header" );
17 header
->forceCloseButtonHidden();
18 m_blueDock
->setHeader( header
);
19 m_blueDock
->setWindowTitle( "Blue" );
20 m_blueDock
->setGeometry( 50, 50, 100, 100 );
21 QWidget
*l
= new QWidget( m_blueDock
);
22 QPalette p1
= l
->palette();
23 p1
.setColor( l
->backgroundRole(), Qt::blue
);
25 l
->setMinimumSize( 100,100 );
26 m_blueDock
->setWidget( l
);
28 setMainDockWidget( m_blueDock
);
30 m_redDock
= createDockWidget( "Red Widget", SmallIcon("akregator") );
31 m_redDock
->setEnableDocking( K3DockWidget::DockFullSite
);
32 //m_redDock->setDetachable( false );
33 header
= new K3DockWidgetHeader( m_redDock
, "Red kHeader" );
34 m_redDock
->setHeader( header
);
35 m_redDock
->setWindowTitle( "Red" );
36 m_redDock
->setGeometry( 50, 50, 100, 100 );
37 l
= new QWidget( m_redDock
);
38 QPalette p2
= l
->palette();
39 p2
.setColor( l
->backgroundRole(), Qt::red
);
41 l
->setMinimumSize( 100,100 );
42 m_redDock
->setWidget( l
);
43 m_redDock
->manualDock( m_blueDock
, K3DockWidget::DockLeft
, 3000 );
45 m_yellowDock
= createDockWidget( "Yellow Widget", SmallIcon("internet-web-browser") );
46 m_yellowDock
->setEnableDocking( K3DockWidget::DockFullSite
);
47 //m_yellowDock->setDetachable( false );
48 // header = new K3DockWidgetHeader( m_yellowDock, "Yellow Header" );
49 // m_yellowDock->setHeader( header );
50 m_yellowDock
->setWindowTitle( "Yellow" );
51 m_yellowDock
->setGeometry( 50, 50, 100, 100 );
52 l
= new QWidget( m_yellowDock
);
53 QPalette p3
= l
->palette();
54 p3
.setColor( l
->backgroundRole(), Qt::yellow
);
56 l
->setMinimumSize( 100,100 );
57 m_yellowDock
->setWidget( l
);
58 m_yellowDock
->manualDock( m_blueDock
, K3DockWidget::DockTop
, 5000 );
62 main( int argc
, char** argv
)
64 KCmdLineArgs::init( argc
, argv
, "docktest", 0, ki18n("DockTest"), "1.0", ki18n("docktest"));
66 DockTest
* ap
= new DockTest();
67 ap
->setWindowTitle("DockWidget demo");
72 #include "kdocktest.moc"