Originally Posted by franco.amato Which code do you need? I exactly copied from the mainwindow example. I get the icon in the menu but the toolbar is not created Qt Code: Switch view void MainWindow::createToolBar(){ exitToolBar = addToolBar(tr("Exit")); exitToolBar->addAction(exitAct);} void MainWindow::createToolBar() { exitToolBar = addToolBar(tr("Exit")); exitToolBar->addAction(exitAct); } To copy to clipboard, switch view to plain text mode and the action Qt Code: Switch view /* Exit action */exitAct = new QAction(QIcon(":/images/exit.png"), tr("E&xit"), this);exitAct->setShortcut( tr("Ctrl+Q") );exitAct->setStatusTip(tr("Exit the application"));connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) ); /* Exit action */ exitAct = new QAction(QIcon(":/images/exit.png"), tr("E&xit"), this); exitAct->setShortcut( tr("Ctrl+Q") ); exitAct->setStatusTip(tr("Exit the application")); connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) ); To copy to clipboard, switch view to plain text mode the qrc file: Qt Code: Switch view <RCC> <qresource> <file>images/exit.png</file> </qresource></RCC> <RCC> <qresource> <file>images/exit.png</file> </qresource> </RCC> To copy to clipboard, switch view to plain text mode I don't understand why the toolbar is not created. I solved the problem, but now I would know if Qt support 48 x 48 icons in the toolbar because seems that only support 32 x 32. Best Regards
void MainWindow::createToolBar(){ exitToolBar = addToolBar(tr("Exit")); exitToolBar->addAction(exitAct);}
void MainWindow::createToolBar() { exitToolBar = addToolBar(tr("Exit")); exitToolBar->addAction(exitAct); }
/* Exit action */exitAct = new QAction(QIcon(":/images/exit.png"), tr("E&xit"), this);exitAct->setShortcut( tr("Ctrl+Q") );exitAct->setStatusTip(tr("Exit the application"));connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) );
/* Exit action */ exitAct = new QAction(QIcon(":/images/exit.png"), tr("E&xit"), this); exitAct->setShortcut( tr("Ctrl+Q") ); exitAct->setStatusTip(tr("Exit the application")); connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) );
<RCC> <qresource> <file>images/exit.png</file> </qresource></RCC>
<RCC> <qresource> <file>images/exit.png</file> </qresource> </RCC>
Franco Amato
Forum Rules
Bookmarks