This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Adding a QDockWidget to a KXmlGuiWindow by editing it's main widget in QT Designer

Tags: None
(comma "," separated)
clintonthegeek
Registered Member
Posts
49
Karma
0
Hi everyone!

I'm trying to get into Qt/KDE application programming, and have hit a snag implementing QDockWidgets in my application.

This is all from the basic template provided by KDevelop 4, so while I understand what's going on, I just don't know the best way to change it.

I've got these classes:
Code: Select all
class AEmpire: public KXmlGuiWindow()
class AEmpireView: public QWidget(), public Ui::aempireview_base


The AEmpire created in my main.cpp, which initializes an AEmpireView as the window's "central widget".

So the UI I'm editing in Qt Designer (aempireview_base.ui) is just a QWidget, and so while I can drag QDockWidgets into it, they won't auto-dock, and aren't draggable when they are floated -- they just sit there immovably until I close or re-unfloat (haha) them back to their static spot in the QWidget.

Apparently in order to actually have fully functional QDockWidgets I need to embed them into a QMainWindow (which KXmlGuiWindow inherits from), where they will be docked next to the windows main widget, not inside of it.

So, how do I add functional QDockWidgets into my main application? Is designing them separately, and add them to the UI by hand in AEmpire.cpp the best option? Or maybe removing the entire AEmpireView class, and making my ui file directly represent a KXmlGuiWindow object to be loaded by the AEmpireClass?

Or am I totally overlooking something obvious? Thanks for reading!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I am not too familar with KXmlGuiWidget myself, but I would design the QDockWidgets individually ( easier to refactor later ) then manually bring them in.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
clintonthegeek
Registered Member
Posts
49
Karma
0
Alright. That shouldn't be too hard, thanks for the help!


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell