PDA

View Full Version : raised view of Widgets.



krishna.bv
4th January 2007, 07:13
hi,
i have a small query regarding the look and feel of the widget that appear.
In application we need to have a facility of showing the windows as raised one compared to its back ground.
in a sense the window that appears on another one should be as if it was stacked over it.
did any one implemented some thing similar.
also ,once a window is obtained its status is shown in the status bar at the base.how to access this bar and make the words appering on it in bold.

thanks in advance.
regards,
krishna.

manivannan_1984
4th January 2007, 07:35
statusBar()->message(""<b>Loading....</b>");


I hope this will help you...........


Mani..

krishna.bv
4th January 2007, 13:05
Thank you can you send any help on how to make a window to have raised look compared to its back ground window?

manivannan_1984
4th January 2007, 13:19
You can just play with frameShape and frameShadow properties... to change your widgets appearance.. You only need to manaully change ur child widgets property .. qt will not do automatically...

Mani

krishna.bv
5th January 2007, 05:14
Thanks for the info. If possible can you send a piece of code?

jpn
5th January 2007, 07:14
In application we need to have a facility of showing the windows as raised one compared to its back ground.
in a sense the window that appears on another one should be as if it was stacked over it.
did any one implemented some thing similar.
Could you post a screenshot of something similar? I have difficulties understanding what do you mean by this. Are you talking about raised child widgets inside a window, or about two separate top level windows?

krishna.bv
5th January 2007, 14:09
Yes we need to have a raised view of widgets(basically objects of QMainWindow) inside QMainWindow. But the child windows need to be like elevated portions when compared with the back ground.

i am unable to find a function in QMainWindow which will get the things done like the one we have in QFrame.

jpn
5th January 2007, 14:19
Yes we need to have a raised view of widgets(basically objects of QMainWindow) inside QMainWindow. But the child windows need to be like elevated portions when compared with the back ground.

i am unable to find a function in QMainWindow which will get the things done like the one we have in QFrame.
I still don't understand.. :)

The underlying window manager or operating system handles frames and title bars of top level widgets, aka. windows. Why would you put several main windows inside each other? You would end up having several menubars and such.

Could you please try to for example use designer and your favourite painting program to provide an image to explain the situation?

krishna.bv
5th January 2007, 15:15
We are basically designing MDI application. the child windows broaders should be some what bulged and raised when compared with the back ground.
please let me know if i am clear now.

jpn
5th January 2007, 15:30
Have you noticed QWorkspace? If that is no option, you could also take a look at Qt Designer, and how does it do the window handling in it's multi window user interface mode.

krishna.bv
6th January 2007, 10:07
But there is no member function in QWorkspace that does this. it is in QFrame only.

krishna.bv
6th January 2007, 12:49
Our application is similar to mdi example given in examples.
the windows that we get from new->file option should have thick frame which should have raised view.

wysota
6th January 2007, 13:19
I think the goal here is to have a QMainWindow subclass with a pseudo-3d look using the same mechanism i.e. frames and push buttons use (by colouring part of the border in dark shades and the opposite in light shades). But then maybe it's enough to inherit QFrame instead of QMainWindow? Do you really need QMainWindow functionality there?

krishna.bv
6th January 2007, 13:24
yes we need to have QMainWindow functionality there. please a small snippet of code i have done to get some thick boarders where am i going wrong.

jpn
6th January 2007, 13:43
Painting using a QPainter on a QWidget can only take place in a QWidget::paintEvent().

krishna.bv
11th January 2007, 11:55
Hi,Thanks for the info.
please find the implementation.
though i am able to get various colours., my purpose still is not done,.

please find attached my code and snapshot of what i got and what i need to obtain.

jpn
11th January 2007, 12:07
please find attached my code and snapshot of what i got and what i need to obtain.
I still have problems understanding what is the goal. How do you want it to look like?

Maybe you could simply use a QFrame as the central widget of the QMainWindow? QFrame has various properties to adjust the look and feel of the frame. You can change the color of the frame by using style sheets (http://doc.trolltech.com/4.2/stylesheet.html) or QPalette.

krishna.bv
16th January 2007, 12:31
Hi,
please find the image attached that contains the part of my window i need to paint.
is it so tricky to do and beyonds the capabilities of Qt.

wysota
16th January 2007, 13:23
void MyWidget::paintEvent(QPaintEvent *e){
QPainter p(this);
QPen pen = p.pen();
pen.setWidth(10);
pen.setColor(Qt::red);
p.setPen(pen);
p.drawRect(rect());
QWidget::paintEvent(e);
}

Doesn't this work?

krishna.bv
18th January 2007, 09:53
Thank you very much!
It worked only in the interior of wndow. i actually want the frame to be drawn. the frame which holds the windows.
Also how to draw the frame in different colours. please see the out put that i have obtained with your code, Wysota.

the painted red rectangle is now movable with the window. but any mouse event is repainting the window and the red rectangle is disappearing. how to over come this?

wysota
18th January 2007, 10:36
It worked only in the interior of wndow. i actually want the frame to be drawn. the frame which holds the windows.
Also how to draw the frame in different colours.
Oh, you mean the window decoration? That's not possible, the window manager handles that. You can only turn off the decoration and draw one yourself, but it's quite hard and doesn't really give satisfactory results.


the painted red rectangle is now movable with the window. but any mouse event is repainting the window and the red rectangle is disappearing. how to over come this?

Did you reimplement any of the mouse events?

krishna.bv
25th January 2007, 11:26
Sorry for the delay in response Wysota, i am on vacation.
First of all thank you :-)
I have not re implemented the mouse event.
shall i have to do that.

wysota
25th January 2007, 12:21
No, but something is causing the rectangle to disappear. Could you prepare a minimal compilable example reproducing the problem?