From: Norbert Moutarde Date: Sat, 26 Apr 2014 16:52:36 +0000 (+0200) Subject: attempt to add scrollarea ... X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=a1136963898aa1c37827bd4896002f1edc43ecc0;p=diary-mobile.git attempt to add scrollarea ... --- diff --git a/mainwindow.cpp b/mainwindow.cpp index d020cf9..c22c272 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -21,9 +21,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) conf->setValue(QString("first"), 1); }; screen=new QWidget(this); - scroll=new QScrollArea(screen); - grid=new QGridLayout(scroll); screen->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + /*scroll=new QScrollArea; + scroll->setWidget(screen); + scroll->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + scroll->setVerticalScrollBarPolicy(2);*/ + grid=new QGridLayout(screen); + grid->setSizeConstraint(QLayout::SetMinimumSize); + + signalmap=new QSignalMapper(this); connect(signalmap, SIGNAL(mapped(const QString &)), this, SLOT(action(const QString &))); connect(this, SIGNAL(datafilled()), this, SLOT(start())); @@ -352,7 +358,7 @@ void MainWindow::getButtons(const QString &a){ if(updatelocker.tryLock(60000))updatelocker.unlock(); else{qDebug()<<"updatelocker is locked more than 1mn";} QString b="%"+a+"%"; - QList tmp({"select label,action from ui where keyword like ?;", b}); + QList tmp({"select label,action from ui where keyword like ? order by id;", b}); label->setText(a); exec(tmp); int labCol = 0;//r.indexOf("label"); @@ -372,7 +378,7 @@ void MainWindow::chooseButtonDB(){ } void MainWindow::chooseButtonDB(const QString & a){ flush(); - qDebug()<<"exec()="<({"select id,label from ui where keyword like ?;", a})); + qDebug()<<"exec()="<({"select id,label from ui where keyword like ? order by id;", a})); while (q->next()) { const QString action="edit "+q->value(0).toString(); addWidget(action, new CLabel(q->value(1).toString(), conf->value(QString("button")).toString())); @@ -393,7 +399,7 @@ void MainWindow::editButtonDB(const QString & a){ } void MainWindow::downloadUi(){ - qDebug()<<"updateUi() : "<value(QString("download"), QVariant("https://raw.github.com/Nothing2Do/diary-mobile-android/master/ui.sql")).toString(); + qDebug()<<"updateUi() : "<value(QString("download")).toString(); download(conf->value(QString("download")).toString()); connect(m, SIGNAL(downloaded()), SLOT(writeUi())); }