Qt GUI: made the Qt4 main window native Qt4 (no more use of Q3MainWindow)
This commit is contained in:
@@ -10,9 +10,11 @@
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qgroupbox.h>
|
||||
#include <qtabdialog.h>
|
||||
#define QTABDIALOG QTabDialog
|
||||
#else // Qt4 ->
|
||||
#include <Q3GroupBox>
|
||||
#include <Q3TabDialog>
|
||||
#define QTABDIALOG Q3TabDialog
|
||||
#endif // QT 3/4
|
||||
@@ -26,7 +28,6 @@ class ConfNull;
|
||||
class RclConfig;
|
||||
class ConfParamW;
|
||||
class ConfParamDNLW;
|
||||
class QGroupBox;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
@@ -54,12 +55,6 @@ public:
|
||||
ConfTopPanelW(QWidget *parent, ConfNull *config);
|
||||
};
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qgroupbox.h>
|
||||
#else
|
||||
#include <Q3GroupBox>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A panel for the parameters that can be changed in subdirectories:
|
||||
*/
|
||||
|
||||
+25
-8
@@ -33,18 +33,13 @@ using std::pair;
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qfiledialog.h>
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include <qcstring.h>
|
||||
#include <qpopupmenu.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qfiledialog.h>
|
||||
#else
|
||||
#include <q3filedialog.h>
|
||||
#define QFileDialog Q3FileDialog
|
||||
#include <q3toolbar.h>
|
||||
#define QToolBar Q3ToolBar
|
||||
#endif
|
||||
|
||||
#include <qtabwidget.h>
|
||||
@@ -175,15 +170,29 @@ void RclMain::init()
|
||||
// Toolbar+combobox version of the category selector
|
||||
QComboBox *catgCMB = 0;
|
||||
if (prefs.catgToolBar) {
|
||||
catgCMB = new QComboBox(FALSE, new QToolBar(this), "catCMB");
|
||||
QToolBar *catgToolBar = new QToolBar(this);
|
||||
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
|
||||
catgCMB->insertItem(tr("All"));
|
||||
#if (QT_VERSION >= 0x040000)
|
||||
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
|
||||
catgCMB->setToolTip(tr("Document category filter"));
|
||||
catgToolBar->addWidget(catgCMB);
|
||||
this->addToolBar(Qt::TopToolBarArea, catgToolBar);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Document categories buttons
|
||||
#if (QT_VERSION < 0x040000)
|
||||
catgBGRP->setColumnLayout(1, Qt::Vertical);
|
||||
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
|
||||
#else
|
||||
QHBoxLayout *bgrphbox = new QHBoxLayout(catgBGRP);
|
||||
QButtonGroup *bgrp = new QButtonGroup(catgBGRP);
|
||||
bgrphbox->addWidget(allRDB);
|
||||
int bgrpid = 0;
|
||||
bgrp->addButton(allRDB, bgrpid++);
|
||||
connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int)));
|
||||
#endif
|
||||
list<string> cats;
|
||||
rclconfig->getMimeCategories(cats);
|
||||
// Text for button 0 is not used. Next statement just avoids unused
|
||||
@@ -197,8 +206,17 @@ void RclMain::init()
|
||||
but->setText(tr(catgnm));
|
||||
if (prefs.catgToolBar && catgCMB)
|
||||
catgCMB->insertItem(tr(catgnm));
|
||||
#if (QT_VERSION >= 0x040000)
|
||||
bgrphbox->addWidget(but);
|
||||
bgrp->addButton(but, bgrpid++);
|
||||
#endif
|
||||
}
|
||||
#if (QT_VERSION < 0x040000)
|
||||
catgBGRP->setButton(0);
|
||||
#else
|
||||
catgBGRP->setLayout(bgrphbox);
|
||||
#endif
|
||||
|
||||
if (prefs.catgToolBar)
|
||||
catgBGRP->hide();
|
||||
// Connections
|
||||
@@ -264,7 +282,6 @@ void RclMain::init()
|
||||
connect(indexConfigAction, SIGNAL(activated()), this, SLOT(showIndexConfig()));
|
||||
connect(queryPrefsAction, SIGNAL(activated()), this, SLOT(showUIPrefs()));
|
||||
connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog()));
|
||||
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
|
||||
if (prefs.catgToolBar && catgCMB)
|
||||
connect(catgCMB, SIGNAL(activated(int)), this, SLOT(catgFilter(int)));
|
||||
connect(periodictimer, SIGNAL(timeout()), this, SLOT(periodic100()));
|
||||
|
||||
@@ -34,13 +34,8 @@
|
||||
#if QT_VERSION < 0x040000
|
||||
#include "rclmain.h"
|
||||
#else
|
||||
#if QT_VERSION >= 0x040601
|
||||
// 4.6.1 uic is broken
|
||||
#include "ui_rclmain.h-4.5"
|
||||
#else
|
||||
#include "ui_rclmain.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
@@ -50,10 +45,10 @@ class DummyRclMainBase : public RclMainBase
|
||||
};
|
||||
#define RCLMAINPARENT QWidget
|
||||
#else
|
||||
class DummyRclMainBase : public Q3MainWindow, public Ui::RclMainBase
|
||||
class DummyRclMainBase : public QMainWindow, public Ui::RclMainBase
|
||||
{
|
||||
public: DummyRclMainBase(QWidget *parent) :Q3MainWindow(parent){setupUi(this);}
|
||||
#define RCLMAINPARENT Q3MainWindow
|
||||
public: DummyRclMainBase(QWidget *parent) :QMainWindow(parent){setupUi(this);}
|
||||
#define RCLMAINPARENT QMainWindow
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
Reference in New Issue
Block a user