Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
|
|
Source code |
1 |
private slots: void AddFiles() { QFileDialog filedialog(this); filedialog.exec(); }
|
|
|
Source code |
1 |
FormPlaylist.h:74: error: no matching function for call to ‘QFileDialog::QFileDialog(Ui_DialogPlaylist* const, Qt::WFlags)’/usr/include/qt4/QtGui/qfiledialog.h:247: note: candidates are: QFileDialog::QFileDialog(const QFileDialog&)/usr/include/qt4/QtGui/qfiledialog.h:240: note: QFileDialog::QFileDialog(const QFileDialogArgs&)/usr/include/qt4/QtGui/qfiledialog.h:92: note: QFileDialog::QFileDialog(QWidget*, const QString&, const QString&, const QString&)/usr/include/qt4/QtGui/qfiledialog.h:88: note: QFileDialog::QFileDialog(QWidget*, Qt::WindowFlags) |
Quoted
class Ui_DialogPlaylist: public QWidget (and other classes if you need) {....};
This post has been edited 1 times, last edit by "Seth666" (Dec 5th 2007, 4:21pm)
Quoted
Originally posted by Seth666
The constructor you want to use takes as a aparent argument class which has to inherit from QWidget, probably your class declaration should look like this
Quoted
class Ui_DialogPlaylist: public QWidget (and other classes if you need) {....};
|
|
Source code |
1 |
class Ui_DialogPlaylist: public QWidget, QObject |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
FormPlaylist.h:40: warning: direct base ‘QObject’ inaccessible in ‘Ui_DialogPlaylist’ due to ambiguity FormPlaylist.h: In member function ‘void Ui_DialogPlaylist::setupUi(QDialog*)’: FormPlaylist.h:68: error: reference to ‘connect’ is ambiguous /usr/include/qt4/QtCore/qobject.h:292: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) /usr/include/qt4/QtCore/qobject.h:292: error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) FormPlaylist.h:68: error: reference to ‘connect’ is ambiguous /usr/include/qt4/QtCore/qobject.h:292: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) /usr/include/qt4/QtCore/qobject.h:292: error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) FormPlaylist.h:69: error: reference to ‘connect’ is ambiguous /usr/include/qt4/QtCore/qobject.h:292: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) /usr/include/qt4/QtCore/qobject.h:292: error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) FormPlaylist.h:69: error: reference to ‘connect’ is ambiguous /usr/include/qt4/QtCore/qobject.h:292: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) /usr/include/qt4/QtCore/qobject.h:292: error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) FormPlaylist.h:70: error: reference to ‘connect’ is ambiguous /usr/include/qt4/QtCore/qobject.h:292: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) /usr/include/qt4/QtCore/qobject.h:292: error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) FormPlaylist.h:70: error: reference to ‘connect’ is ambiguous /usr/include/qt4/QtCore/qobject.h:292: error: candidates are: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) /usr/include/qt4/QtCore/qobject.h:292: error: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const /usr/include/qt4/QtCore/qobject.h:191: error: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) |
|
|
Source code |
1 |
class Ui_DialogPlaylist: QObject |
|
|
Source code |
1 2 3 4 5 6 |
void AddFiles()
{
cout << "in addfilesn";
//QFileDialog filedialog(this);
//filedialog.exec();
}
|
|
|
Source code |
1 2 3 |
connect(btnaddfiles, SIGNAL( released() ), this, SLOT( AddFiles() ) ); connect(btnremove, SIGNAL( released() ), this, SLOT( RemoveFromPlaylist() ) ); connect(btnclearlist, SIGNAL( released() ), this, SLOT( ClearPlaylist() ) ); |
so your class shouldn't do this again.|
|
Source code |
1 2 3 4 5 6 7 |
class Ui_DialogPlaylist: public QWidget
{
Q_OBJECT //just this
...... //
.......//everything else
};
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
#ifndef FORMPLAYLIST_H
#define FORMPLAYLIST_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include <QtGui/QListWidget>
#include <QtGui/QPushButton>
#include <QtGui/QFileDialog>
#include <iostream>
using namespace std;
class Ui_DialogPlaylist: public QWidget
{
Q_OBJECT
public:
QPushButton *btnaddfiles;
QPushButton *btnremove;
QPushButton *btnclearlist;
QListWidget *lstplaylist;
void setupUi(QDialog *DialogPlaylist)
{
if (DialogPlaylist->objectName().isEmpty())
DialogPlaylist->setObjectName(QString::fromUtf8("DialogPlaylist"));
DialogPlaylist->resize(265, 236);
btnaddfiles = new QPushButton(DialogPlaylist);
btnaddfiles->setObjectName(QString::fromUtf8("btnaddfiles"));
btnaddfiles->setGeometry(QRect(0, 190, 75, 31));
btnremove = new QPushButton(DialogPlaylist);
btnremove->setObjectName(QString::fromUtf8("btnremove"));
btnremove->setGeometry(QRect(70, 190, 111, 31));
btnclearlist = new QPushButton(DialogPlaylist);
btnclearlist->setObjectName(QString::fromUtf8("btnclearlist"));
btnclearlist->setGeometry(QRect(180, 190, 75, 31));
lstplaylist = new QListWidget(DialogPlaylist);
lstplaylist->setObjectName(QString::fromUtf8("lstplaylist"));
lstplaylist->setGeometry(QRect(0, 0, 256, 192));
retranslateUi(DialogPlaylist);
connect(btnaddfiles, SIGNAL( released() ), this, SLOT( AddFiles() ) );
connect(btnremove, SIGNAL( released() ), this, SLOT( RemoveFromPlaylist() ) );
connect(btnclearlist, SIGNAL( released() ), this, SLOT( ClearPlaylist() ) );
QMetaObject::connectSlotsByName(DialogPlaylist);
} // setupUi
void retranslateUi(QDialog *DialogPlaylist)
{
DialogPlaylist->setWindowTitle(QApplication::translate("DialogPlaylist", "Playlist", 0, QApplication::UnicodeUTF8));
btnaddfiles->setText(QApplication::translate("DialogPlaylist", "Add files", 0, QApplication::UnicodeUTF8));
btnremove->setText(QApplication::translate("DialogPlaylist", "Remove from list", 0, QApplication::UnicodeUTF8));
btnclearlist->setText(QApplication::translate("DialogPlaylist", "Clear list", 0, QApplication::UnicodeUTF8));
Q_UNUSED(DialogPlaylist);
} // retranslateUi
private slots:
void AddFiles()
{
cout << "in addfilesn";
//QFileDialog filedialog(this);
//filedialog.exec();
}
void RemoveFromPlaylist()
{
lstplaylist->removeItemWidget(lstplaylist->currentItem());
}
void ClearPlaylist()
{
lstplaylist->clear();
}
};
namespace Ui {
class DialogPlaylist: public Ui_DialogPlaylist {};
} // namespace Ui
#endif // FORMPLAYLIST_H
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
#ifndef FORMMAINWINDOW_H
#define FORMMAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QFrame>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
#include <QtGui/QPushButton>
#include "FormPlaylist.h"
#include <iostream>
using namespace std;
class Ui_MainWindow: QObject
{
Q_OBJECT
public:
QWidget *centralwidget;
QFrame *frame;
QLabel *lblsongtitle;
QLabel *lblsongtitle_3;
QPushButton *btnnext;
QPushButton *btnplaypause;
QPushButton *btnstop;
QLabel *lblsongtitle_2;
QLabel *lblsongduration;
QLabel *lblsongplayed;
QPushButton *btnprevious;
QLabel *lblsongtitle_4;
QLabel *lblstatus;
QPushButton *btnplaylist;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(312, 162);
MainWindow->setDockOptions(QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks);
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
frame = new QFrame(centralwidget);
frame->setObjectName(QString::fromUtf8("frame"));
frame->setGeometry(QRect(0, 0, 311, 131));
frame->setFrameShape(QFrame::StyledPanel);
frame->setFrameShadow(QFrame::Raised);
lblsongtitle = new QLabel(frame);
lblsongtitle->setObjectName(QString::fromUtf8("lblsongtitle"));
lblsongtitle->setGeometry(QRect(0, 0, 54, 22));
lblsongtitle_3 = new QLabel(frame);
lblsongtitle_3->setObjectName(QString::fromUtf8("lblsongtitle_3"));
lblsongtitle_3->setGeometry(QRect(0, 40, 54, 22));
btnnext = new QPushButton(frame);
btnnext->setObjectName(QString::fromUtf8("btnnext"));
btnnext->setGeometry(QRect(150, 90, 60, 31));
btnplaypause = new QPushButton(frame);
btnplaypause->setObjectName(QString::fromUtf8("btnplaypause"));
btnplaypause->setGeometry(QRect(30, 90, 60, 31));
btnplaypause->setMaximumSize(QSize(16777215, 16777215));
btnstop = new QPushButton(frame);
btnstop->setObjectName(QString::fromUtf8("btnstop"));
btnstop->setGeometry(QRect(90, 90, 60, 31));
lblsongtitle_2 = new QLabel(frame);
lblsongtitle_2->setObjectName(QString::fromUtf8("lblsongtitle_2"));
lblsongtitle_2->setGeometry(QRect(0, 20, 54, 22));
lblsongduration = new QLabel(frame);
lblsongduration->setObjectName(QString::fromUtf8("lblsongduration"));
lblsongduration->setGeometry(QRect(250, 20, 54, 22));
lblsongduration->setLayoutDirection(Qt::RightToLeft);
lblsongplayed = new QLabel(frame);
lblsongplayed->setObjectName(QString::fromUtf8("lblsongplayed"));
lblsongplayed->setGeometry(QRect(250, 40, 54, 22));
lblsongplayed->setLayoutDirection(Qt::RightToLeft);
btnprevious = new QPushButton(frame);
btnprevious->setObjectName(QString::fromUtf8("btnprevious"));
btnprevious->setGeometry(QRect(210, 90, 60, 31));
lblsongtitle_4 = new QLabel(frame);
lblsongtitle_4->setObjectName(QString::fromUtf8("lblsongtitle_4"));
lblsongtitle_4->setGeometry(QRect(0, 60, 54, 22));
lblstatus = new QLabel(frame);
lblstatus->setObjectName(QString::fromUtf8("lblstatus"));
lblstatus->setGeometry(QRect(250, 60, 54, 22));
lblstatus->setLayoutDirection(Qt::RightToLeft);
btnplaylist = new QPushButton(centralwidget);
btnplaylist->setObjectName(QString::fromUtf8("btnplaylist"));
btnplaylist->setGeometry(QRect(230, 130, 75, 31));
btnplaylist->setAcceptDrops(false);
btnplaylist->setDefault(false);
btnplaylist->setFlat(false);
MainWindow->setCentralWidget(centralwidget);
retranslateUi(MainWindow);
connect(btnplaylist, SIGNAL( released() ), this, SLOT( OpenPlaylist() ));
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Linamp", 0, QApplication::UnicodeUTF8));
lblsongtitle->setText(QApplication::translate("MainWindow", "xxx", 0, QApplication::UnicodeUTF8));
lblsongtitle_3->setText(QApplication::translate("MainWindow", "Played :", 0, QApplication::UnicodeUTF8));
btnnext->setText(QApplication::translate("MainWindow", "Next", 0, QApplication::UnicodeUTF8));
btnplaypause->setText(QApplication::translate("MainWindow", "Play", 0, QApplication::UnicodeUTF8));
btnstop->setText(QApplication::translate("MainWindow", "Stop", 0, QApplication::UnicodeUTF8));
lblsongtitle_2->setText(QApplication::translate("MainWindow", "Duration :", 0, QApplication::UnicodeUTF8));
lblsongduration->setText(QApplication::translate("MainWindow", "xxx", 0, QApplication::UnicodeUTF8));
lblsongplayed->setText(QApplication::translate("MainWindow", "xxx", 0, QApplication::UnicodeUTF8));
btnprevious->setText(QApplication::translate("MainWindow", "Previous", 0, QApplication::UnicodeUTF8));
lblsongtitle_4->setText(QApplication::translate("MainWindow", "Status :", 0, QApplication::UnicodeUTF8));
lblstatus->setText(QApplication::translate("MainWindow", "xxx", 0, QApplication::UnicodeUTF8));
btnplaylist->setText(QApplication::translate("MainWindow", "Open playlist", 0, QApplication::UnicodeUTF8));
Q_UNUSED(MainWindow);
} // retranslateUi
private slots:
void OpenPlaylist()
{
QDialog *playlistdialog = new QDialog;
cout << "inside openplaylistn";
Ui_DialogPlaylist playlist;
playlist.setupUi(playlistdialog);
playlistdialog->show();
}
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
#endif // FORMMAINWINDOW_H
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include <QApplication>
#include <QMainWindow>
#include <QDialog>
#include "FormMainwindow.h"
#include "FormPlaylist.h"
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "startedn";
QApplication app(argc, argv);
QMainWindow * mainwindow = new QMainWindow;
//QDialog * mainwindow = new QDialog;
Ui_MainWindow x;
//Ui_DialogPlaylist x;
x.setupUi(mainwindow);
mainwindow->show();
return app.exec();
}
|
This post has been edited 1 times, last edit by "NGF" (Dec 6th 2007, 8:39am)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 |
#include <QApplication>
#include "MainWindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include <QWidget>
#include <QAction>
#include <QMainWindow>
#include <QtGui>
#include <QFileDialog>
#include <QString>
#include "InfoWidget.h"
#include "ImageWidget.h"
class MainWindow:public QMainWindow
{
Q_OBJECT
public:
MainWindow();
~MainWindow(); //you don't have to use destructor
private:
QPushButton *button;
InfoWidget *widget; //as you can see i'am also using other classes, you will probable insert here some other widget
//
// everything else, methods, slots
/// you should insert here your buttons "next", "previous"
//
};
|
|
|
Source code |
1 2 3 4 5 6 7 8 |
MainWindow::MainWindow()
{
button1= new QPushButton("button1", this);
...............
...............
...............
}
|
This post has been edited 1 times, last edit by "Seth666" (Dec 6th 2007, 12:59pm)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <QApplication>
#include <QMainWindow>
#include <QDialog>
#include "FormMainwindow.h"
#include "FormPlaylist.h"
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "startedn";
QApplication app(argc, argv);
//QMainWindow * mainwindow = new QMainWindow;
//QDialog * mainwindow = new QDialog;
//Ui_MainWindow x;
//Ui_DialogPlaylist x;
//x.setupUi(mainwindow);
Ui_MainWindow mainwindow;
mainwindow.show();
return app.exec();
}
|
|
|
Source code |
1 2 3 |
/usr/include/qt4/QtGui/qwidget.h:463: error: ‘void QWidget::show()’ is inaccessible main.cpp:38: error: within this context main.cpp:38: error: ‘QWidget’ is not an accessible base of ‘Ui_MainWindow’ |
This post has been edited 1 times, last edit by "NGF" (Dec 6th 2007, 4:40pm)