Improve look on Mac.
[dorian] / widgets / dyalog.cpp
index db75c88..baea41a 100644 (file)
@@ -12,6 +12,8 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_):
                     Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint),
     showButtons(showButtons_)
 {
+    setAttribute(Qt::WA_DeleteOnClose);
+
     scroller = new QScrollArea(this);
 
 #if defined(Q_WS_MAEMO_5)
@@ -25,10 +27,16 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_):
 #endif
     scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     scroller->setFrameStyle(QFrame::NoFrame);
+#if defined(Q_OS_SYMBIAN)
+    // setStyleSheet("QFrame {margin:0; border:0; padding:0}");
+    setStyleSheet("QScrollArea {margin:0; border:0; padding:0}");
+#endif
 
     content = new QWidget(scroller);
     contentLayout = new QVBoxLayout(content);
+#if !defined(Q_OS_SYMBIAN)
     contentLayout->setMargin(0);
+#endif
     content->setLayout(contentLayout);
 
     QBoxLayout *boxLayout;
@@ -48,6 +56,9 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_):
 #endif
         boxLayout = new QHBoxLayout(this);
     }
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
+    boxLayout->setMargin(0);
+#endif
     boxLayout->addWidget(scroller);
 #ifndef Q_OS_SYMBIAN
     if (showButtons) {
@@ -90,27 +101,25 @@ void Dyalog::addButton(const QString &label, QObject *receiver,
     }
 #ifdef Q_OS_SYMBIAN
     Q_UNUSED(role);
-#if 0
     if (!leftSoftKey) {
-        qDebug() << "Adding left soft key";
+        // Add new action as left softkey
         leftSoftKey = new QAction(label, this);
         leftSoftKey->setSoftKeyRole(QAction::PositiveSoftKey);
         connect(leftSoftKey, SIGNAL(triggered()), receiver, slot);
         addAction(leftSoftKey);
     } else {
-#endif
         if (!menuBar) {
-            qDebug() << "Creating menu bar";
+            // Create menu bar
             menuBar = new QMenuBar(this);
+            // Add previous LSK to menu bar
+            leftSoftKey->setSoftKeyRole(QAction::NoSoftKey);
             menuBar->addAction(leftSoftKey);
         }
-        qDebug() << "Adding to menu bar";
+        // Add new action to menu bar
         QAction *action = new QAction(label, this);
         connect(action, SIGNAL(triggered()), receiver, slot);
         menuBar->addAction(action);
-#if 0
     }
-#endif
 #else
     QPushButton *button = new QPushButton(label, this);
     connect(button, SIGNAL(clicked()), receiver, slot);
@@ -125,7 +134,7 @@ void Dyalog::show()
     foreach (QWidget *w, QApplication::allWidgets()) {
         w->setContextMenuPolicy(Qt::NoContextMenu);
     }
-    showMaximized();
+    QDialog::showMaximized();
 }
 
 int Dyalog::exec()