Hi, is there interest to also drop all functions enabled by the QT3_SUPPORT macro?
If yes, why not inverting the QT3_SUPPORT macro logic: not defining it for the whole project, but only in front of the cpp file? Attached some patches, which frees from QT3_SUPPORT. Peter
Index: QCommandBuffer.C =================================================================== --- QCommandBuffer.C (Revision 13994) +++ QCommandBuffer.C (Arbeitskopie) @@ -8,6 +8,8 @@ * Full author contact details are available in file CREDITS. */ +#undef QT3_SUPPORT + #include <config.h> // Qt defines a macro 'signals' that clashes with a boost namespace. @@ -84,10 +86,10 @@ QHBoxLayout * layout = new QHBoxLayout(0); QPushButton * up = new QPushButton(qpup, "", this); - QToolTip::add(up, qt_("Previous command")); + up->setToolTip(qt_("Previous command")); connect(up, SIGNAL(clicked()), this, SLOT(up())); QPushButton * down = new QPushButton(qpdown, "", this); - QToolTip::add(down, qt_("Next command")); + down->setToolTip(qt_("Next command")); connect(down, SIGNAL(clicked()), this, SLOT(down())); edit_ = new QCommandEdit(this); Index: QLToolbar.C =================================================================== --- QLToolbar.C (Revision 13994) +++ QLToolbar.C (Arbeitskopie) @@ -12,6 +12,8 @@ * Full author contact details are available in file CREDITS. */ +#undef QT3_SUPPORT + #include <config.h> #include "buffer.h" @@ -47,6 +49,7 @@ return lv.buffer()->params().getLyXTextClass(); } +/* /// \todo Remove Qt::Dock getPosition(ToolbarBackend::Flags const & flags) if not needed anymore Qt::Dock getPosition(ToolbarBackend::Flags const & flags) { @@ -60,6 +63,7 @@ return Qt::DockRight; return Qt::DockTop; } +*/ Qt::ToolBarArea getToolBarPosition(ToolbarBackend::Flags const & flags) { @@ -101,7 +105,7 @@ int i = 0; for (; i < combo_->count(); ++i) { - if (name == combo_->text(i)) + if (name == combo_->itemText(i)) break; } @@ -111,7 +115,7 @@ return; } - combo_->setCurrentItem(i); + combo_->setCurrentIndex(i); } @@ -128,7 +132,7 @@ for (; it != end; ++it) { // ignore obsolete entries if ((*it)->obsoleted_by().empty()) - combo_->insertItem(qt_((*it)->name())); + combo_->addItem(qt_((*it)->name())); } // needed to recalculate size hint @@ -149,7 +153,7 @@ void QLayoutBox::open() { - combo_->popup(); + combo_->showPopup(); } Index: QtView.C =================================================================== --- QtView.C (Revision 13994) +++ QtView.C (Arbeitskopie) @@ -10,6 +10,8 @@ * Full author contact details are available in file CREDITS. */ +#undef QT3_SUPPORT + #include <config.h> #include "BufferView.h" @@ -43,8 +45,8 @@ #include <QToolBar> #include <QCloseEvent> #include <QAction> -#include <QMenu> -#include <QMenuBar> +//#include <QMenu> +//#include <QMenuBar> #include "support/lstrings.h" @@ -73,7 +75,7 @@ { resize(width, height); - qApp->setMainWidget(this); + mainWidget_ = this; // setToolButtonStyle(Qt::ToolButtonIconOnly); // setIconSize(QSize(12,12)); @@ -95,7 +97,7 @@ // since the icon is provided in the application bundle. string const iconname = libFileSearch("images", "lyx", "xpm"); if (!iconname.empty()) - setIcon(QPixmap(toqstr(iconname))); + setWindowIcon(QPixmap(toqstr(iconname))); #endif // make sure the buttons are disabled if needed @@ -129,7 +131,7 @@ void QtView::message(string const & str) { - statusBar()->message(toqstr(str)); + statusBar()->showMessage(toqstr(str)); statusbar_timer_.stop(); statusbar_timer_.start(statusbar_timer_value); } @@ -150,7 +152,7 @@ void QtView::update_view_state_qt() { - statusBar()->message(toqstr(getLyXFunc().viewStatusMessage())); + statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage())); statusbar_timer_.stop(); } @@ -161,7 +163,7 @@ if (statusbar_timer_.isActive()) return; - statusBar()->message(toqstr(getLyXFunc().viewStatusMessage())); + statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage())); } @@ -194,7 +196,7 @@ void QtView::show() { - setCaption(qt_("LyX")); + QMainWindow::setWindowTitle(qt_("LyX")); QMainWindow::show(); } @@ -202,11 +204,19 @@ void QtView::busy(bool yes) const { if (yes) - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); else QApplication::restoreOverrideCursor(); } +QMainWindow* QtView::mainWidget() +{ + return mainWidget_; +} + +QMainWindow* QtView::mainWidget_ = 0; + + } // namespace frontend } // namespace lyx Index: QtView.h =================================================================== --- QtView.h (Revision 13994) +++ QtView.h (Arbeitskopie) @@ -36,6 +36,7 @@ class QCommandBuffer; +QWidget* mainWindow(); /** * QtView - Qt implementation of LyXView @@ -71,6 +72,8 @@ // returns true if this view has the focus. virtual bool hasFocus() const; + static QMainWindow* mainWidget(); + public slots: /// idle timeout void update_view_state_qt(); @@ -99,6 +102,9 @@ /// command buffer QCommandBuffer * commandbuffer_; + + /// + static QMainWindow* mainWidget_; }; } // namespace frontend Index: QWorkArea.C =================================================================== --- QWorkArea.C (Revision 13994) +++ QWorkArea.C (Arbeitskopie) @@ -16,6 +16,7 @@ #include "QWorkArea.h" #include "QLPainter.h" #include "QLyXKeySym.h" +#include "QtView.h" #include "lcolorcache.h" #include "qt_helpers.h" @@ -122,12 +123,12 @@ QWorkArea::QWorkArea(LyXView & owner, int w, int h) - : QAbstractScrollArea(qApp->mainWidget()), WorkArea(), view_(owner), painter_(this) + : QAbstractScrollArea(lyx::frontend::QtView::mainWidget()), WorkArea(), view_(owner), painter_(this) { setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this); + lyx::frontend::QtView::mainWidget()->setCentralWidget(this); setAcceptDrops(true);