You are not logged in.
Right now the "quit" button in a Qt programme I'm working on looks like this:
The code I'm using is,
exitAct = new QAction(tr("&Quit"), this);
exitAct->setShortcut(tr("Ctrl+Q", "Quit"));
I'd like it to have the standard quit icon I see in all my other programmes:
Does anyone know how I can do this?
Last edited by tony5429 (2009-06-20 20:34:24)
Offline
http://doc.trolltech.com/4.5/qaction.html#icon-prop
Every QAction has an icon property, use that to set icons.
I would recommend looking at: http://code.google.com/p/qticonloader/ for a cross-platform way of setting icons.
However, that doesn't support KDE3 so well, so I use:
action_File_New->setIcon(QtIconLoader::icon("document-new",
QtIconLoader::icon("filenew",
QApplication::style()->standardIcon(
QStyle::SP_FileIcon))));
for File >> New
Check out http://standards.freedesktop.org/icon-n … 01s04.html for icon names
Offline
Thanks for your suggestion, scio. Do you know how I could, rather than going with the qticonloader, simply use the kde4 standard icon for, say the File >> New button icon?
Offline
1) copy all of the resources into your project in a qrc file.
2) Use http://doc.trolltech.com/4.5/qstyle.html#standardIcon
I would still highly recommend using qticonloader as it is written by a Nokia dev and will most likely be added in future versions of Qt.
Offline
Hrm.. Well I tried out qticonloader and it worked perfectly. My only concern is qticonloader is licenced LGPL whereas my project is licenced GPL. Do you know if I can simply include qticonloader in my project without changing my licence?
Offline
8 ** Commercial Usage ...
13 **
14 ** GNU Lesser General Public License Usage
15 ** Alternatively, this file may be used under the terms of the GNU Lesser
16 ** General Public License version 2.1 as published by the Free Software
17 ** Foundation and appearing in the file LICENSE.LGPL included in the
18 ** packaging of this file. ...22 ** In addition, as a special exception, Nokia gives you certain
23 ** additional rights. These rights are described in the Nokia Qt LGPL
24 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
25 ** package.
26 **
27 ** GNU General Public License Usage
28 ** Alternatively, this file may be used under the terms of the GNU
29 ** General Public License version 3.0 as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL included in the
31 ** packaging of this file. Please review the following information to
32 ** ensure the GNU General Public License version 3.0 requirements will be
33 ** met: http://www.gnu.org/copyleft/gpl.html.
The code can be used under any of the Qt licenses, including GPL. Just follow GPL 3.0 rules and you will be fine.
Offline
Hrm... so I can just drop that cpp and h file into my package and not worry about it?
Offline
As long as you distribute the GPL with it like you would anyway for a GPL project.
Offline
Okay; sounds good then. Yeah; I've got the COPYING file included in the archive already.
Offline