Need Help for tabs in title bar
I am developing document reader for my college final year project using QT 4.8.4.
I want to implement tabs in tile bar ui (like chrome) in cross platform manner.
I tried many things but not able to do.
Can any body help ?
I am new to qt so please help.
and one more thing
it is possible to add tool bar to qtab widget ?
Because i want to add tool bar to each tab.
So please help
and thank u for reply in advanced.
u have two choice:
- u can start using "QTabWidget":http://doc.qt.digia.com/qt/qtabwidget.html and build ur own custom Model.
- or Create ur own new Widget
I will try this.
Still need more guidance and explanation.
Painting on the window borders in this or another form is a question that pops on these forums quite often, but the answer is always the same: it's either a lot of non-portable work or a lot of non-portable work ;)
Window managers are very very OS specific and you can't do what you want easily.
The only semi-portable way of doing this is removing window frame entirely (via a flag Qt::FramelessWindowHint in your widget) and handling EVERYTHING yourself, including sizing, moving, painting and any OS specific window behavior in existence.
The not so portable way is to use a lot of #ifdefs, and use whatever trickery the platform offers.
On windows for example this would be handling of windows messages like WM_NCPAINT, WM_NCHITTEST and a fair degree of trouble with painting if you want to get the glassy aero right.
I've done this a few times myself but with very limited results and to be honest - if you don't really really need those few pixels at the top spare yourself a lot of trouble and stay in windows's client area.
To Krzysztof Kawa
U mean if some one want to implement Painting on the window borders in cross platform manner
it has to done by himself ?
It is possible that the solution can be available as custom widget as this question is asked by many programmers ?
What I'm saying is that if you manage to create such a portable and flexible widget a lot of people might thank you :)
The reality is that it's such an app-specific task, that there is very little gain in generalizing it into a widget. Some apps draw there menus(Photoshop), some tabs(Google chrome), there is this Office started trend of putting there differently shaped "start buttons" (Firefox, 3DS Max) or even animations and many many other things.
At the end of the day the app ends up with drawing and handling input in it's own manner anyway. To generalize it you would have to allow for drawing on something like QPixmap and then under the covers draw part of it on a client area widget and part on the border in a platform specific way. This might or might not be less efficient than drawing directly using OS api facilities. There is also question of user input behavior which you would have to translate into some common events, which are often not really that common between OSes. Some OSes don't even have frames if you think about it. What then? You would have to assure some sane fallback.
All that rarely comes close to looking "native".
It's a broad subject, and to some degree all apps that do that have some issues with it. Some do it better, some worse, some are deliberately non-portable but in my experience nobody nailed it yet.
ok. I will try to do that as soon as my project is done. Now for my own problem. I got one application from KDE called rekonq. It is light web browser. It has similar layout (tabs in title bar) in its latest version 2.0 as i need to implement . And best part is it is implemented using qt.
I am trying to understand the source code. Still it will be better if someone land a hand in it.
I will also trying to understand chromium web browser code.
I hope i will get good results soon.
What do u think about ribbon ui ? it can be widget ?
Sure. You can even buy an "implementation":http://www.devmachines.com/qtitanribbon-overview.html of it for Qt. I've run some tests with it, and it seems to work nicely.
I might be wrong but weren't there some MS restrictions as to where you can use ribbon ui? E.g. not in MS competing products (text editors, data sheets etc.)?
There are. See the comment on the bottom of the page I linked to:
[quote]Remarks on the licensing Ribbon UI
If you create an application that uses QtitanRibbon components, you must agree to a licensing agreement with Microsoft for the Ribbon UI before you can deploy your application. You receive no rights in the Ribbon UI from Developer Machines. You can request a license from Microsoft at http://msdn.microsoft.com/en-us/office/aa973809/.[/quote]
Thank u Andre for your expert Guidance. Can you help me on my problem. I still haven't solve it completely.
You'll have to be more specific on what your (remaining) problems are than that to get usable answers...
I am developing a document reader application for my college project using QT.
For that i trying to achieve the user interface same as chrome ( having tabs in title bar with new tab button and each tab has its own tool bar). I am trying to achieve this in cross platform manner so that i can develop and deploy the application on Windows, Mac os x and Linux.
this is my problem that how can i do this using qt ?
As you were told before: there is no cross-platform way to do this. Drawing in the client-area (as it is called on windows at least) is not supported by Qt.
Thank u for answer. I am changing my layout as i don't have enough time to implement it effectively. Instead of drawing tabs on window border i am drawing them inside the window as i draw in following frame
is this will be cross platform with qt ?
Sure, that should be easy to get cross platform. As long as you use normal widgets and don't do OS specific code, it should be completely cross platform.