+ issue #0000953: No scroll bar on preferences dialog window
This commit is contained in:
parent
cea0daa5e6
commit
064b5f851c
|
@ -28,8 +28,10 @@
|
||||||
# include <QApplication>
|
# include <QApplication>
|
||||||
# include <QDebug>
|
# include <QDebug>
|
||||||
# include <QDesktopWidget>
|
# include <QDesktopWidget>
|
||||||
|
# include <QGenericReturnArgument>
|
||||||
# include <QMessageBox>
|
# include <QMessageBox>
|
||||||
# include <QScrollArea>
|
# include <QScrollArea>
|
||||||
|
# include <QScrollBar>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Base/Exception.h>
|
#include <Base/Exception.h>
|
||||||
|
@ -253,8 +255,9 @@ void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
|
||||||
if (canEmbedScrollArea) {
|
if (canEmbedScrollArea) {
|
||||||
// embed the widget stack into a scroll area if the size is
|
// embed the widget stack into a scroll area if the size is
|
||||||
// bigger than the available desktop
|
// bigger than the available desktop
|
||||||
int maxHeight = QApplication::desktop()->height();
|
QRect rect = QApplication::desktop()->availableGeometry();
|
||||||
int maxWidth = QApplication::desktop()->width();
|
int maxHeight = rect.height();
|
||||||
|
int maxWidth = rect.width();
|
||||||
if (height() > maxHeight || width() > maxWidth) {
|
if (height() > maxHeight || width() > maxWidth) {
|
||||||
canEmbedScrollArea = false;
|
canEmbedScrollArea = false;
|
||||||
ui->hboxLayout->removeWidget(ui->tabWidgetStack);
|
ui->hboxLayout->removeWidget(ui->tabWidgetStack);
|
||||||
|
@ -263,11 +266,30 @@ void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
scrollArea->setWidget(ui->tabWidgetStack);
|
scrollArea->setWidget(ui->tabWidgetStack);
|
||||||
ui->hboxLayout->addWidget(scrollArea);
|
ui->hboxLayout->addWidget(scrollArea);
|
||||||
|
|
||||||
|
// if possible the minimum width should so that it doesn't show
|
||||||
|
// a horizontal scroll bar.
|
||||||
|
QScrollBar* bar = scrollArea->verticalScrollBar();
|
||||||
|
if (bar) {
|
||||||
|
int newWidth = width() + bar->width();
|
||||||
|
newWidth = std::min<int>(newWidth, maxWidth);
|
||||||
|
int newHeight = std::min<int>(height(), maxHeight-30);
|
||||||
|
QMetaObject::invokeMethod(this, "resizeWindow",
|
||||||
|
Qt::QueuedConnection,
|
||||||
|
QGenericReturnArgument(),
|
||||||
|
Q_ARG(int, newWidth),
|
||||||
|
Q_ARG(int, newHeight));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QDialog::resizeEvent(ev);
|
QDialog::resizeEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DlgPreferencesImp::resizeWindow(int w, int h)
|
||||||
|
{
|
||||||
|
resize(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
void DlgPreferencesImp::changeEvent(QEvent *e)
|
void DlgPreferencesImp::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::LanguageChange) {
|
if (e->type() == QEvent::LanguageChange) {
|
||||||
|
|
|
@ -126,6 +126,7 @@ protected:
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void changeGroup(QListWidgetItem *current, QListWidgetItem *previous);
|
void changeGroup(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
void on_buttonBox_clicked(QAbstractButton*);
|
void on_buttonBox_clicked(QAbstractButton*);
|
||||||
|
void resizeWindow(int w, int h);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** @name for internal use only */
|
/** @name for internal use only */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user