Circumvented the loading problem that occured on Windows.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1220 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2011-03-20 03:13:32 +00:00
parent 6b57a90879
commit f95b6d079a
2 changed files with 6 additions and 3 deletions

View File

@@ -86,7 +86,8 @@ ElementsPanel::ElementsPanel(QWidget *parent) :
QTreeWidget(parent), QTreeWidget(parent),
common_collection_item_(0), common_collection_item_(0),
custom_collection_item_(0), custom_collection_item_(0),
first_activation_(true) first_activation_(true),
first_reload_(true)
{ {
// selection unique // selection unique
@@ -544,7 +545,7 @@ void ElementsPanel::startDrag(Qt::DropActions supportedActions) {
*/ */
bool ElementsPanel::event(QEvent *event) { bool ElementsPanel::event(QEvent *event) {
if (first_activation_ && event -> type() == QEvent::WindowActivate) { if (first_activation_ && event -> type() == QEvent::WindowActivate) {
reload(false); QTimer::singleShot(250, this, SLOT(reload()));
first_activation_ = false; first_activation_ = false;
} }
return(QTreeWidget::event(event)); return(QTreeWidget::event(event));
@@ -802,7 +803,8 @@ void ElementsPanel::reload(bool reload_collections) {
custom_collection_item_ = addCollection(invisibleRootItem(), QETApp::customElementsCollection(), tr("Collection utilisateur"), QIcon(":/ico/16x16/go-home.png")); custom_collection_item_ = addCollection(invisibleRootItem(), QETApp::customElementsCollection(), tr("Collection utilisateur"), QIcon(":/ico/16x16/go-home.png"));
// the first time, expand the first level of collections // the first time, expand the first level of collections
if (first_activation_) { if (first_reload_) {
first_reload_ = true;
common_collection_item_ -> setExpanded(true); common_collection_item_ -> setExpanded(true);
custom_collection_item_ -> setExpanded(true); custom_collection_item_ -> setExpanded(true);
} }

View File

@@ -143,5 +143,6 @@ class ElementsPanel : public QTreeWidget {
QTreeWidgetItem *custom_collection_item_; QTreeWidgetItem *custom_collection_item_;
int loading_progress_; int loading_progress_;
bool first_activation_; bool first_activation_;
bool first_reload_;
}; };
#endif #endif