I have an error in ui file, reference on not existed file. Now it types me this ui_filewidget.h:34: error: ISO C++ forbids declaration of 'myListWidget' with no type![]()
I have an error in ui file, reference on not existed file. Now it types me this ui_filewidget.h:34: error: ISO C++ forbids declaration of 'myListWidget' with no type![]()
Last edited by Phalanx; 19th April 2010 at 21:26.
You do understand that you should never, ever, edit the generated files such as ui_*.h, right?
Sure, but I try that. I delete it then and generated new, it is not a problem.
Problem is how to give an ui to my promoted QListWidget. I cannot use Ui::myListWidgetClass *ui in here. I dont know how to write it. It would be great if I get ui from constructor
class myListWidget : public QListWidget
{
Q_OBJECT
public:
explicit myListWidget(QWidget *parent = 0, TableWidget *ref_TableWidget = 0);
Ui::myListWidgetClass *ui;
Last edited by Phalanx; 20th April 2010 at 06:03.
Well you can't design a QListWidget alone in designer. So I guess the QListWidget is in a mainwindow and you want to be able to access other elements like buttons from your subclassed QListWidget. If so, just pass a pointer from the main windows to your subclass. But better is to use signals and slots. Your case is exactly why they exists...
I know what you mean, it would be great if I can use code example. But I haven't got an ui pointer because I have promoted QListWidget to myListWidget
action_New = new QAction("&New", ui->treeWidget);
action_Open = new QAction("&Open", ui->treeWidget);
//add the code at slots
connect(action_New, SIGNAL(triggered()), this, SLOT(on_action_New_triggered()));
connect(action_Open, SIGNAL(triggered()), this, SLOT(on_action_Open_triggered()));
ui->treeWidget->addAction(action_New);
ui->treeWidget->addAction(action_Open);
ui->treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
I have code it by this tutorial (option first): forum_Nokia
I need to use ui in class RCQListWidget, please help![]()
Solved. Use first manual but register ui->listWidget->installEventFilter(this); in constructor of up widget
Bookmarks