How can I create a widget list as Qt Designer?
I'd like to create in my main window something like a widget list (Qt desgigner has what I want) with different sections. Which componets or widgets should I use? (Can I do it without creating new components?)
With scrollbar and dockwindow (this one is easy to add). Filter would be nice. I guess is just another componet.
http://img524.imageshack.us/img524/1...9hj96rkgjb.jpg
Thanks a lot for your help.
Re: How can I create a widget list as Qt Designer?
You could search the forum more. This had been discussed as far as I remember,
Hint 1 : QTreeView with delegates.
Hint 2: Dig in Designer code if available :)
Re: How can I create a widget list as Qt Designer?
Quote:
Originally Posted by
aamer4yu
You could search the forum more. This had been discussed as far as I remember,
Hint 1 : QTreeView with delegates.
Hint 2: Dig in Designer code if available :)
Thanks for reply. Unfortunately I'm a beginner so I don't understand it very well.
I only need several string lists with an icon every one, separeted by bold string (like the screenshot). Can I do it in a easy way? I don't know if I could delegate a class and add that functionality.
Thanks for help. Any idea?
Re: How can I create a widget list as Qt Designer?
Quote:
Originally Posted by
ricardo
Thanks for reply. Unfortunately I'm a beginner so I don't understand it very well.
Then please use the Newbie section of this board. You are welcome.
Quote:
I only need several string lists with an icon every one, separeted by bold string (like the screenshot). Can I do it in a easy way?
Yes, there is an easy way: QTreeView with delegates!
Quote:
I don't know if I could delegate a class and add that functionality.
Look, the designer is a great tool, but it can't do anything for you. Still Qt is "part" of the C++ programming language, so you have to be a little knowledge of that if you want to work with it. For the delegate thing look in the docks, or as aamer4yu said ind the sources of designer.
Re: How can I create a widget list as Qt Designer?
OK. Thanks, I will read about that.
Well, this is what I was looking for:
http://www.qtcentre.org/forum/f-qt-p...ner-14912.html
Re: How can I create a widget list as Qt Designer?
yea, using pushbutton looks good... but u have to make extra connections for buttons clicked... isnt it ?
With delegates you wont have to both so much...
Just made a simple delegate u can start with...
Code:
{
protected:
{
if(index.child(0,0).isValid())
{
painter->setPen(Qt::blue);
//painter->drawRect(option.rect);
opt.rect = option.rect;
qApp
->style
()->drawControl
(QStyle::CE_PushButton,
&opt,painter
);
}
}
};
You will need to call view->setItemDelegate(new TreeWidgetDelegate());
thats it.
also to achieve expand/collapse on single click like in designer, you can connect itemClicked signal to some function of yours..
Like ,,,
Code:
MainWindow::MainWindow()
{
ui.setupUi(this);
ui.treeWidget->expandAll();
ui.treeWidget->setItemDelegate(new TreeDelegate());
ui.treeWidget->setRootIsDecorated(false);
}
{
item->setSelected(false);
item->setExpanded(!item->isExpanded());
}
One thing more to be noted is in Qt 4.5 designer has icon view too... so not sure if they have used tree widget for that... May be they might have used treewidget, with one parent one child... and the child must be QListWidget...;)