giusepped
18th October 2008, 03:08
I am a newbie.
I have a simple code:
mainWindow::mainWindow()
{
QTextEdit *editor1 = new QTextEdit;
QTextEdit *editor2 = new QTextEdit;
QTextEdit *editor3 = new QTextEdit;
QSplitter splitter(Qt::Horizontal,this);
splitter.addWidget(editor1);
splitter.addWidget(editor2);
splitter.addWidget(editor3);
editor1->setPlainText("Mon enfant, ma soeur,\n"
"Songe à la douceur\n"
"D'aller là -bas vivre ensemble,\n"
"Aimer à loisir,\n"
"Aimer et mourir\n"
"Au pays qui te ressemble.");
editor2->setPlainText("My child, my sister,\n"
"think of the sweetness\n"
"of going there to live together!\n"
"To love at leisure,\n"
"to love and to die\n"
"in a country that is the image of you!");
editor3->setPlainText("Mein Kind, meine Schwester,\n"
"denke an den Traum\n"
"dort hin(unter) zu gehen um zusammen\n"
"zu leben und in aller Ruhe zu lieben,\n"
"Zu lieben und zu sterben\n"
"in dem Land, das dir gleicht.");
splitter.setWindowTitle(QObject::tr("Splitter"));
setCentralWidget(splitter);
}
and the main is straightforward:
#include <QtGui>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow *mainWindow =new QMainWindow;
mainWindow->show();
return app.exec();
}
But when I compile, i get the error
mainwindow.cpp:61: error: no matching function for call to 'mainWindow::setCentralWidget(QSplitter&)'
/usr/include/QtGui/qmainwindow.h:122: note: candidates are: void QMainWindow::setCentralWidget(QWidget*)
I don't understand why. Maybe because I am using qt3 and not qt4?
I have a simple code:
mainWindow::mainWindow()
{
QTextEdit *editor1 = new QTextEdit;
QTextEdit *editor2 = new QTextEdit;
QTextEdit *editor3 = new QTextEdit;
QSplitter splitter(Qt::Horizontal,this);
splitter.addWidget(editor1);
splitter.addWidget(editor2);
splitter.addWidget(editor3);
editor1->setPlainText("Mon enfant, ma soeur,\n"
"Songe à la douceur\n"
"D'aller là -bas vivre ensemble,\n"
"Aimer à loisir,\n"
"Aimer et mourir\n"
"Au pays qui te ressemble.");
editor2->setPlainText("My child, my sister,\n"
"think of the sweetness\n"
"of going there to live together!\n"
"To love at leisure,\n"
"to love and to die\n"
"in a country that is the image of you!");
editor3->setPlainText("Mein Kind, meine Schwester,\n"
"denke an den Traum\n"
"dort hin(unter) zu gehen um zusammen\n"
"zu leben und in aller Ruhe zu lieben,\n"
"Zu lieben und zu sterben\n"
"in dem Land, das dir gleicht.");
splitter.setWindowTitle(QObject::tr("Splitter"));
setCentralWidget(splitter);
}
and the main is straightforward:
#include <QtGui>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow *mainWindow =new QMainWindow;
mainWindow->show();
return app.exec();
}
But when I compile, i get the error
mainwindow.cpp:61: error: no matching function for call to 'mainWindow::setCentralWidget(QSplitter&)'
/usr/include/QtGui/qmainwindow.h:122: note: candidates are: void QMainWindow::setCentralWidget(QWidget*)
I don't understand why. Maybe because I am using qt3 and not qt4?