PDA

View Full Version : minimize slot does not work in linux.Is it a Bug in Qt?



anupamgee
4th June 2009, 07:59
hi All,
i am trying to minimize application on the click of a button.The same code works perfactly in windows but does not work in linux .What i need to do ?

e8johan
4th June 2009, 08:13
How does the non-working code look?

anupamgee
4th June 2009, 09:07
hi,
I have created a frameless QWidget ,then i create a pushbutton and on its clicked signal i called the slot showMinimized() but my frameless widget is not minimizing.
here is the code


widget::widget(QWidget *parent):QWidget(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
QPushButton *button=new QPushButton(this);
button->setGeometry(10,10,20,20);
connect(button,SIGNAL(clicked()),this,SLOT(showMin imized()));
}

this code runs perfectly in windows but does nt work in linux...Why??
Is there any other way to minimize frameless QWidget in linux.

e8johan
4th June 2009, 09:16
Actually, looking at the docs for the showMinimized function, they do say that this only works on Windows. I suspect that this is because the windows manager is responsible for more tasks, and not as standardized, in an X11 environment than a Windows environment.

I would try the setWindowState function and see if that does the trick...

mcosta
4th June 2009, 09:18
From Qt Documents you can read


Qt::FramelessWindowHint Produces a borderless window. The user cannot move or resize a borderless window via the window system. On X11, the result of the flag is dependent on the window manager and its ability to understand Motif and/or NETWM hints. Most existing modern window managers can handle this.



void QWidget::showMinimized () [slot]

Shows the widget minimized, as an icon.

Calling this function only affects windows.


bool QWidget::isWindow () const

Returns true if the widget is an independent window, otherwise returns false.

A window is a widget that isn't visually the child of any other widget and that usually has a frame and a window title.

A window can have a parent widget. It will then be grouped with its parent and deleted when the parent is deleted, minimized when the parent is minimized etc. If supported by the window manager, it will also have a common taskbar entry with its parent.

QDialog and QMainWindow widgets are by default windows, even if a parent widget is specified in the constructor. This behavior is specified by the Qt::Window flag.

Verify the value of Qt::Window flag in X11