]> jfr.im git - irc/kvirc/KVIrc.git/commitdiff
option dialogs: play more nice with low resolutions / exotic resolutions
authorFabio Bas <redacted>
Wed, 8 Oct 2008 08:46:20 +0000 (08:46 +0000)
committerFabio Bas <redacted>
Wed, 8 Oct 2008 08:46:20 +0000 (08:46 +0000)
git-svn-id: https://svn.kvirc.de/svn/branches/kvirc/3.4@2669 17fca916-40b9-46aa-a4ea-0a15b648b75c

src/modules/options/dialog.cpp
src/modules/options/dialog.h

index db3c57212792f8bb05f9b1acff4d4ca4272e2827..b413978e7ead943bbdca3215e17be7146dbd25ee 100644 (file)
@@ -299,6 +299,26 @@ KviOptionsDialog::~KviOptionsDialog()
                g_pOptionsDialogDict->remove(m_szGroup);
 }
 
+void KviOptionsDialog::showEvent(QShowEvent *e)
+{
+       QRect r = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
+               
+       int w = r.width();
+       int h = r.height();
+
+       int ww = width();
+       int wh = height();
+
+       if(w < ww + 100)
+               ww = w - 100;
+
+       if(h < wh + 100)
+               wh = h - 100;
+
+       setGeometry((w - ww) / 2,(h - wh) / 2,ww,wh);
+
+       QDialog::showEvent(e);
+}
 
 void KviOptionsDialog::searchLineEditTextChanged(const QString &)
 {
index 355e4565d3f11606b7a0f4579ee0b6ea58214e33..f2ae10b6fa2d7a2c19a039239c97e5d041c7d82d 100644 (file)
@@ -94,6 +94,7 @@ protected:
        void apply(bool bDialogAboutToClose);
        virtual void closeEvent(QCloseEvent *e);
        virtual void keyPressEvent( QKeyEvent * e );
+       virtual void showEvent(QShowEvent *e);
        bool recursiveSearch(KviOptionsListViewItem * pItem,const QStringList &lKeywords);
 public:
        void search(const QString &szKeywords);