Changeset 1010
- Timestamp:
- Aug 19, 2011, 5:03:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/embedded/embedded.cpp
r1004 r1010 1 #ifdef __OS2__ 1 2 #include <os2.h> 3 #endif 2 4 3 5 #include <QDebug> … … 28 30 layout->addWidget (stable); 29 31 30 return stable->winId(); 32 WId id = stable->winId(); 33 qDebug() << "stable id" << qDebugHWND (id); 34 return id; 31 35 } 32 36 … … 55 59 /* menus */ 56 60 { 57 QMenu *actionsMenu = menuBar()->addMenu ("&Actions");58 61 QAction *playAct = new QAction ("&Play", this); 59 actionsMenu->addAction (playAct);60 61 62 playAct->setShortcut (QKeySequence("Ctrl+P")); 62 63 playAct->setCheckable (true); 63 64 connect (playAct, SIGNAL (triggered(bool)), SLOT (playTriggered(bool))); 65 66 QAction *playListAct = new QAction ("Play&list", this); 67 playListAct->setShortcut (QKeySequence("Ctrl+L")); 68 playListAct->setCheckable (true); 69 connect (playListAct, SIGNAL (triggered(bool)), SLOT (playListTriggered(bool))); 70 71 QMenu *actionsMenu = menuBar()->addMenu ("&Actions"); 72 actionsMenu->addAction (playAct); 73 actionsMenu->addAction (playListAct); 64 74 } 65 75 … … 75 85 stackCentralW = new QStackedWidget (main); 76 86 87 // avoid hiding widgets when tossing the stack (just raise/lower) 88 qobject_cast <QStackedLayout *> (stackCentralW->layout()) 89 ->setStackingMode (QStackedLayout::StackAll); 90 77 91 bgWidget = new QLabel ("Background"); 78 92 stackCentralW->addWidget (bgWidget); … … 84 98 85 99 mainLayout->insertWidget (2, new QLabel ("Controls")); 86 87 100 } 88 101 89 102 void timerEvent (QTimerEvent *) 90 103 { 104 static int tickCount = 0; 105 ++ tickCount; 106 107 if (tickCount == 5) 108 resize (800, 600); 109 #ifdef __OS2__ 91 110 if (id) 92 111 { … … 97 116 { 98 117 RECTL rcl; 99 //WinQueryWindowRect (hwnd, &rcl);118 // WinQueryWindowRect (hwnd, &rcl); 100 119 101 120 rcl.xLeft = 0; … … 111 130 } 112 131 } 132 #endif 113 133 } 114 134 … … 121 141 stackCentralW->setCurrentWidget (videoWidget); 122 142 id = videoWidget->request(); 123 //timerId = startTimer (1000);143 timerId = startTimer (1000); 124 144 } 125 145 else … … 128 148 id = 0; 129 149 killTimer (timerId); 130 //timerId = 0;150 timerId = 0; 131 151 stackCentralW->setCurrentWidget (bgWidget); 152 } 153 } 154 155 void playListTriggered (bool checked) 156 { 157 if (checked) 158 { 159 stackCentralW->setCurrentWidget (bgWidget); 160 } 161 else 162 { 163 stackCentralW->setCurrentWidget (videoWidget); 132 164 } 133 165 }
Note:
See TracChangeset
for help on using the changeset viewer.