Changeset View
Changeset View
Standalone View
Standalone View
src/widget/tableview/kexicomboboxpopup.cpp
Show First 20 Lines • Show All 355 Lines • ▼ Show 20 Line(s) | |||||
356 | { | 356 | { | ||
357 | const int records = qMin(d->maxRecordCount, d->tv->recordCount()); | 357 | const int records = qMin(d->maxRecordCount, d->tv->recordCount()); | ||
358 | 358 | | |||
359 | KexiTableEdit *te = dynamic_cast<KexiTableEdit*>(parentWidget()); | 359 | KexiTableEdit *te = dynamic_cast<KexiTableEdit*>(parentWidget()); | ||
360 | int width = qMax(d->tv->tableSize().width(), | 360 | int width = qMax(d->tv->tableSize().width(), | ||
361 | (te ? te->totalSize().width() : (parentWidget() ? parentWidget()->width() : 0/*sanity*/))); | 361 | (te ? te->totalSize().width() : (parentWidget() ? parentWidget()->width() : 0/*sanity*/))); | ||
362 | //qDebug() << "size=" << size(); | 362 | //qDebug() << "size=" << size(); | ||
363 | const QRect screen = QApplication::desktop()->availableGeometry(this); | 363 | const QRect screen = QApplication::desktop()->availableGeometry(this); | ||
364 | resize(qMin(screen.width(), qMax(minWidth, width)), d->tv->recordHeight() * records + 2); | 364 | resize(qMin(screen.width(), qMax(minWidth, width)), d->tv->recordHeight() * records + 3); | ||
365 | 365 | | |||
366 | //qDebug() << "size after=" << size(); | 366 | //qDebug() << "size after=" << size() << d->tv->verticalScrollBar()->isVisible() << d->tv->horizontalScrollBar()->isVisible(); | ||
367 | if (d->visibleColumnsToShow.isEmpty()) { | 367 | if (d->visibleColumnsToShow.isEmpty()) { | ||
368 | // record source type is not Query | 368 | // record source type is not Query | ||
369 | d->tv->setColumnResizeEnabled(0, true); | 369 | d->tv->setColumnResizeEnabled(0, true); | ||
370 | d->tv->setColumnResizeEnabled(d->tv->columnCount() - 1, false); | 370 | d->tv->setColumnResizeEnabled(d->tv->columnCount() - 1, false); | ||
371 | d->tv->setColumnWidth(1, 0); //!< @todo A temp. hack to hide the bound column | 371 | d->tv->setColumnWidth(1, 0); //!< @todo A temp. hack to hide the bound column | ||
372 | if (d->tv->verticalScrollBar()->isVisible()) { | ||||
373 | d->tv->setColumnWidth(0, d->tv->width() - 1 - d->tv->verticalScrollBar()->width()); | ||||
374 | } else { | ||||
375 | d->tv->setColumnWidth(0, d->tv->width() - 1); | ||||
376 | } | ||||
377 | d->tv->triggerUpdate(); | ||||
378 | if (d->tv->recordNumberAt(0) == 0 && records == d->tv->recordCount()) { | ||||
372 | d->tv->setColumnWidth(0, d->tv->width() - 1); | 379 | d->tv->setColumnWidth(0, d->tv->width() - 1); | ||
373 | } | 380 | } | ||
381 | } | ||||
374 | else { | 382 | else { | ||
375 | // record source type is Query | 383 | // record source type is Query | ||
376 | // Set width to 0 and disable resizing of columns that shouldn't be visible | 384 | // Set width to 0 and disable resizing of columns that shouldn't be visible | ||
377 | const KDbQueryColumnInfo::Vector fieldsExpanded(d->tv->cursor()->query()->fieldsExpanded()); | 385 | const KDbQueryColumnInfo::Vector fieldsExpanded(d->tv->cursor()->query()->fieldsExpanded()); | ||
378 | QList<int>::ConstIterator visibleColumnsToShowIt = d->visibleColumnsToShow.constBegin(); | 386 | QList<int>::ConstIterator visibleColumnsToShowIt = d->visibleColumnsToShow.constBegin(); | ||
379 | for (int i = 0; i < fieldsExpanded.count(); ++i) { | 387 | for (int i = 0; i < fieldsExpanded.count(); ++i) { | ||
380 | bool show = visibleColumnsToShowIt != d->visibleColumnsToShow.constEnd() && i == *visibleColumnsToShowIt; | 388 | bool show = visibleColumnsToShowIt != d->visibleColumnsToShow.constEnd() && i == *visibleColumnsToShowIt; | ||
381 | d->tv->setColumnResizeEnabled(i, show); | 389 | d->tv->setColumnResizeEnabled(i, show); | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |