From 0265dd84fe32abed0186c63b46ad53157f57fe25 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 16 Jun 2011 18:51:26 +0200 Subject: testing positions and sizes of floating widgets to find the better layout alternative... --- src/fbsplash.cpp | 41 ++++++++++++++++++++++++++++++++++------- src/fbsplash.h | 9 +++++++-- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/fbsplash.cpp b/src/fbsplash.cpp index cf42f97..ab85245 100644 --- a/src/fbsplash.cpp +++ b/src/fbsplash.cpp @@ -6,15 +6,31 @@ fbsplash::fbsplash() : qDebug() << "fbsplash init"; - createQuitAction(); - setupTheme(); + createActions(); - QProgressBar* pb; - setCentralWidget(pb); + _label = new QLabel("OpenSLX"); + _label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + + QPalette pal; + pal.setColor(QPalette::Base, Qt::black); + _label->setPalette(pal); + setCentralWidget(_label); + + //QDockWidget *dock = new QDockWidget(this); + //dock->setAllowedAreas(Qt::BottomDockWidgetArea); + QProgressBar* pb = new QProgressBar(this); + //pb->setFormat("Progress: %p%"); + pb->setWindowFlags(Qt::FramelessWindowHint); + pb->setRange(0, 100); + pb->setValue(50); + pb->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + //addDockWidget(Qt::BottomDockWidgetArea, dock); + + //setupTheme(); setAttribute(Qt::WA_QuitOnClose, true); - setWindowFlags(Qt::FramelessWindowHint); - showFullScreen(); + //setWindowFlags(Qt::FramelessWindowHint); + //showFullScreen(); } //----------------------------------------------------------------------------- void fbsplash::setupTheme() { @@ -25,9 +41,20 @@ void fbsplash::setupTheme() { setPalette(pal); } //----------------------------------------------------------------------------- -void fbsplash::createQuitAction() { +void fbsplash::createActions() { + // Quit through CTRL + X _quit = new QAction(tr("&quit"), this); _quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); this->addAction(_quit); connect(_quit, SIGNAL(triggered()), this, SLOT(close())); + // Test action + _printSize = new QAction(tr("&test"), this); + _printSize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W)); + this->addAction(_printSize); + connect(_printSize, SIGNAL(triggered()), this, SLOT(printSizeAction())); +} +//----------------------------------------------------------------------------- +void fbsplash::printSizeAction(){ + qDebug() << "MW Height: " << _label->size().height(); + qDebug() << "MW Width: " << _label->size().width(); } diff --git a/src/fbsplash.h b/src/fbsplash.h index c0a1990..31bf591 100644 --- a/src/fbsplash.h +++ b/src/fbsplash.h @@ -25,10 +25,15 @@ public: private: void setupTheme(); // ** TESTING STUFF ** - void createQuitAction(); + void printSize(); + void createActions(); QAction* _quit; - // ** TESTING STUFF ** + QAction* _printSize; + QLabel* _label; + // ** TESTING STUFF ** +private slots: + void printSizeAction(); }; #endif // FBSPLASH_H -- cgit v1.2.3-55-g7522