PDA

View Full Version : Dialog positioning in GNOME



simk
15th March 2006, 07:27
I seem have come across a problem that exists only in GNOME. The position of a dialog (obtained using pos() ) is incorrect, if and only if the dialog hasn't been moved from its starting position.

I have a included a small test program (Qt4) demonstrating this. At exit, it saves the position of the dialog to a text file ("test.txt"), which it reads upon starting again.

With KDE and XFce (the only other window managers I have), the dialog is placed in the correct position i.e. the position at last exit. But with GNOME, the dialog is placed in the correct position only if it was moved by the user from where it was created, otherwise it is placed at the top left hand corner of the screen.

I have search Qt forums and the Trolltech Task Tracker without finding any reference to this. Has anyone heard of such a possible bug before?



#include <QtGui>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDialog *dialog = new QDialog;
QHBoxLayout *layout = new QHBoxLayout(dialog);
QLabel *label = new QLabel("Testing widget->pos()", dialog);
layout->addWidget(label);

// get position
QFile file("test.txt");
if (file.open(QIODevice::ReadOnly))
{
QString str = file.readAll();
dialog->move(str.split(":")[0].toInt(), str.split(":")[1].toInt());
file.close();
}

dialog->show();

app.exec();

// write position
if (file.open(QIODevice::WriteOnly))
{
QString str = QString("%1:%2").arg(dialog->pos().x())
.arg(dialog->pos().y());
file.write(str.toLocal8Bit());
file.close();
}

return 0;
}

jpn
15th March 2006, 09:56
I tested and noticed the "wrong" behaviour on GNOME. It worked seamless on KDE and WinXP.

This problem might derive from X11's peculiarities, mentioned at: http://doc.trolltech.com/4.1/geometry.html#x11-peculiarities

simk
16th March 2006, 09:41
I tested and noticed the "wrong" behaviour on GNOME. It worked seamless on KDE and WinXP.

This problem might derive from X11's peculiarities, mentioned at: http://doc.trolltech.com/4.1/geometry.html#x11-peculiarities

I can imagine it would, but GNOME being one of the most widely used desktop enviroments on Linux, I would have thought that the Trolls would have found a way around this. That's if they know about it, of course ... I'll send in a bug report, and see what happens.