comparison DataController.cpp @ 66:a60c26e34d1a

Avoid apprent hang in beginning, now application shows, but appears frosen. Need better fix.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Sun, 23 Dec 2012 22:07:57 +0100
parents b9515dc35fe4
children 9744ec195be3
comparison
equal deleted inserted replaced
65:bc55cbd827bf 66:a60c26e34d1a
106 } 106 }
107 107
108 emit populateProgress(++n); 108 emit populateProgress(++n);
109 109
110 QDateTime now = QDateTime::currentDateTime(); 110 QDateTime now = QDateTime::currentDateTime();
111 if (last.msecsTo(now) > 500) { 111 if (last.msecsTo(now) > 1000) {
112 QCoreApplication::processEvents(); 112 QCoreApplication::processEvents();
113 last = now; 113 last = now;
114 } 114 }
115 } 115 }
116 116
393 tw->setSortingEnabled(true); 393 tw->setSortingEnabled(true);
394 tw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 394 tw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
395 tw->setSelectionBehavior(QAbstractItemView::SelectRows); 395 tw->setSelectionBehavior(QAbstractItemView::SelectRows);
396 //tw->resizeColumnsToContents(); 396 //tw->resizeColumnsToContents();
397 mw->resize(800,800); 397 mw->resize(800,800);
398 mw->setEnabled(false);
398 mw->show(); 399 mw->show();
399 } 400 }
400 401
401 402
402 DataController::DataController(const QString& path, bool showGUI) 403 DataController::DataController(const QString& path, bool showGUI)
481 482
482 setDir((searchPath_in.size() > 0) ? searchPath_in : QDir(".")); 483 setDir((searchPath_in.size() > 0) ? searchPath_in : QDir("."));
483 484
484 showFullPath = false; 485 showFullPath = false;
485 486
486 if (showGUI) 487 if (showGUI) {
487 setupGUI(); 488 setupGUI();
489
490 QTimer* populator = new QTimer(this);
491 populator->setSingleShot(true);
492 populator->setInterval(50);
493 connect(populator, SIGNAL(timeout()), this, SLOT(initialPopulate()));
494 populator->start();
495 }
496 else {
497 buildDB(dir);
498 }
499 }
500
501 void DataController::initialPopulate()
502 {
488 buildDB(dir); 503 buildDB(dir);
489 if (showGUI) 504 populate();
490 populate(); 505 mw->setEnabled(true);
491
492 } 506 }
493 507
494 DataController::~DataController() 508 DataController::~DataController()
495 { 509 {
496 delete dblink; 510 delete dblink;