comparison src/pngplayer.cpp @ 38:26e1521b9afd

Add the possibility to detach the picture label on doubleclick
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 18:09:34 +0200
parents 0c05958d254c
children ee696abaab99
comparison
equal deleted inserted replaced
37:0c05958d254c 38:26e1521b9afd
32 32
33 void PNGPlayer::setupGUI() { 33 void PNGPlayer::setupGUI() {
34 QVBoxLayout *baseLayout = new QVBoxLayout; 34 QVBoxLayout *baseLayout = new QVBoxLayout;
35 mPNGLabel = new ImageLabel; 35 mPNGLabel = new ImageLabel;
36 mPNGLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 36 mPNGLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
37 connect(mPNGLabel, &ImageLabel::doubleClicked, this, &PNGPlayer::togglePicFullscreen);
38 connect(mPNGLabel, &ImageLabel::closeRequested, this, &PNGPlayer::togglePicFullscreen);
37 39
38 QHBoxLayout *controlArea = new QHBoxLayout; 40 QHBoxLayout *controlArea = new QHBoxLayout;
39 QHBoxLayout *controlBtns = new QHBoxLayout; 41 QHBoxLayout *controlBtns = new QHBoxLayout;
40 controlArea->addLayout(controlBtns); 42 controlArea->addLayout(controlBtns);
41 controlArea->addStretch(-1); 43 controlArea->addStretch(-1);
195 setSpeed(REPLAY_SPEED_STEP_MS / 2); 197 setSpeed(REPLAY_SPEED_STEP_MS / 2);
196 } 198 }
197 QSettings settings; 199 QSettings settings;
198 settings.setValue(REPLAY_SPEED_KEY, (mSpeedSlider->value() * REPLAY_SPEED_STEP_MS) / 1000.0); 200 settings.setValue(REPLAY_SPEED_KEY, (mSpeedSlider->value() * REPLAY_SPEED_STEP_MS) / 1000.0);
199 } 201 }
202
203 void PNGPlayer::togglePicFullscreen() {
204 qDebug() << "togglePicFullscreen";
205 QVBoxLayout *baseLayout = qobject_cast<QVBoxLayout*>(layout());
206 if (!baseLayout) {
207 qWarning() << "Wrong layout!";
208 return;
209 }
210 if (baseLayout->indexOf(mPNGLabel) == -1) {
211 baseLayout->insertWidget(0, mPNGLabel);
212 } else {
213 baseLayout->removeWidget(mPNGLabel);
214 mPNGLabel->setParent(NULL, Qt::Tool);
215 mPNGLabel->showMaximized();
216 }
217 }
218
219 void PNGPlayer::close() {
220 QVBoxLayout *baseLayout = qobject_cast<QVBoxLayout*>(layout());
221 if (!baseLayout) {
222 qWarning() << "Wrong layout!";
223 return;
224 }
225 if (baseLayout->indexOf(mPNGLabel) == -1) {
226 delete mPNGLabel;
227 }
228 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)