[PyKDE] QToolButton

Mikael Schönenberg micke at strakt.com
Fri Jan 16 12:51:01 GMT 2004


On Fri, 16 Jan 2004, claude.faath wrote:

>         self.fileOpen = QToolButton(QPixmap(fileopen), 'Open File', 'Opens a new file', self.open, \
>                                     toolBar, 'Open file')
>         self.fileSave = QToolButton(QPixmap(filesave), 'Save File', 'Saves current file', self.save, \
>                                     toolBar, 'Save file')
>
>         self.addToolBar(toolBar, "Main toolbar")

I replaced the above lines with the following ones:

        self.fileOpen = QToolButton(QIconSet(QPixmap(fileopen)),
                                   'Open File',
                                    'Opens a new file', self.open,
                                    toolBar, 'Open file')
        self.fileSave = QToolButton(QIconSet(QPixmap(filesave)),
                                    'Save File',
                                    'Saves current file', self.save,
                                    toolBar, 'Save file')

        #self.addToolBar(toolBar, "Main toolbar")
        self.addDockWindow(toolBar, "Main toolbar")

And things work fine :)

The constructor to QToolButton takes a QIconSet as first argument, not a
QPixMap (at least in QT 3.2.1, which is what I'm running).


More information about the PyQt mailing list