[Qt-interest] QMainWindow: setWindowTitle() & setWindowIcon() don't work
Miguel Cardenas
mfcardenas at gmail.com
Sun Dec 14 19:51:19 CET 2008
Hi
Sorry it was layer related not to Qt, I used to program with Qt3 and some
things changed, after some codings there's no more problem :)
thanks
On Thu, Dec 11, 2008 at 2:44 PM, Constantin Makshin <
dinosaur-rus at users.sourceforge.net> wrote:
> Couldn't you provide some minimal example that suffers from this issue so
> other people could test it? I don't have any problems with neither
> setWindowTitle() or setWindowIcon() for QMainWindow.
>
> On Thu, 11 Dec 2008 20:38:48 +0300, Miguel Cardenas <mfcardenas at gmail.com>
> wrote:
> > Hi list
> >
> > I made a small application with the new Qt4 to see the changes respect
> > Qt3... it is finished and working so decided to play with the title bar
> > and found that setWindowTitle() & setWindowIcon() don't work with
> > QMainWindow...
> >
> > My first code was like this:
> >
> > #include "my_pixmap.xpm"
> >
> > MainWindow::MainWindow (QApplication* app) {
> > setWindowTitle(tr("some title"));
> > setWindowIcon(QIcon(QPixmap(my_pixmap)));
> > ...
> > }
> >
> > then replaced by this one:
> >
> > MainWindow::MainWindow (QApplication* app) {
> > setWindowTitle(tr("some title"));
> > QApplication::setWindowIcon(QIcon(QPixmap(my_pixmap)));
> > ...
> > }
> >
> > but it sets the same icon for all my windows, by now it is okay but what
> > if I want it only for my current QMainWindow?
> >
> > Respect the setWindowTitle() it didn't work in any tested way, it is
> > always the name of the executable file..
> >
> > Tried these combinadions and any worked:
> >
> > setWindowTitle(tr("some title"));
> > setWindowTitle(QString("some title"));
> > setWindowTitle(QString(tr("some title")));
> >
> > QString title("some title");
> > setWindowTitle(title);
> >
> > QString title(tr("some title"));
> > setWindowTitle(title);
> >
> > and nothing, the title remains as the executable filename. The
> > documentation says QMainWindow inherits QWidget that has available both
> > setWindowTitle() and setWindowIcon() so it should work, but no, the icon
> > only could be modified via the QApplication::setWindowIcon() and the
> > title in any way.
> >
> > What is wrong in this code?
> >
> > Thanks
>
> --
> Constantin "Dinosaur" Makshin
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Miguel Cardenas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081214/69f56b80/attachment.html
More information about the Qt-interest-old
mailing list