QT Thread

Not about OpenMW? Just about Morrowind in general? Have some random babble? Kindly direct it here.
Post Reply
User avatar
Star-Demon
Posts: 73
Joined: 11 Aug 2011, 03:17
Location: New York
Contact:

QT Thread

Post by Star-Demon »

So -I've been playing with QT - and I like that it's like MSVC, but just a few thing :

Is it possible to download custom made widgets?

Are there tooltips for anything? It's frustrating because MSVC has tooltips for most properties and widgets, I'm having a hard time looking around because of this.

What's the difference between item-based and model based tables? When should one be used?

Otherwise, I just need to learn the basic pieces of code to open or close a form, show or hide a form, etc.
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: QT Thread

Post by pvdk »

Good to see you're playing with Qt.

1. What widgets do you need? You can subclass existing widgets to create your own or indeed download widgets. Check for example the Widgets catagory on Qt-Apps.org. Two projects with custom widgets are LibQxt and wwWidgets. There's also a project on SourceForge which has Qt widgets for technical applications, but I think you won't need those.

2. Tooltips are quite easy with Qt. Every widget has the setToolTip() property. Make sure you enclose the tooltip string in a tr(). Tooltip strings which contain html are treated as rich text, so you can get tooltips like the launcher has. Docs can be found here and here.

3. In short, the difference is the use of the Model/View paradigm. (Very important feature of Qt!)
For example, you have QTableWidget which has its own internal model, and you have QTableView which looks the same but needs a separate model, to be supplied using setModel(). That way you can have more complex data which is for example displayed in several views. It is also convenient because it seperates the data from the way it is displayed. Think for example about filtering. You would need to remove the rows from QTableWidget whereas you can keep them in the model and filter the data that's displayed in QTableView.

4. Information regarding showing and hiding "forms" (which are called dialogs in Qt) can be found here. Qt also has some standard dialogs, for example a file dialog. Those can be found here.

Example:

Code: Select all

// Modal dialog
QDialog dialog(this);
dialog.exec();

// Modeless dialog
QDialog dialog(this);
dialog.show();
Simple as that!
Subclass QDialog to actually display something. Examples here.

PS: It's Qt, not QT. QT is QuickTime. Qt is pronounced as cute.
User avatar
Star-Demon
Posts: 73
Joined: 11 Aug 2011, 03:17
Location: New York
Contact:

Re: QT Thread

Post by Star-Demon »

Actually - I meant Tooltips in QtCreator itself - I'd like to know what all these new properties and things actually are and what they do :)

Thanks though! :)
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: QT Thread

Post by pvdk »

Dunno about Qt Creator, I never use it.
User avatar
Star-Demon
Posts: 73
Joined: 11 Aug 2011, 03:17
Location: New York
Contact:

Re: QT Thread

Post by Star-Demon »

Going well so far - I got a lot done today.

I don't think it's memory efficient, but I can open new forms, and close the application.

Now, I need to learn how to populate tables, and read data from entire rows. it's help if I control the size of certain columns.
Post Reply