Added code to automatically resize (enlarge) the main window if it is too small for all widgets/strings to fit in. Mainly useful for translations that contain strings which are significant longer than the default translation.

This commit is contained in:
LoRd_MuldeR 2011-04-05 14:57:21 +02:00
parent 18352a1976
commit 709a4c2079
3 changed files with 46 additions and 7 deletions

View File

@ -32,6 +32,9 @@
<property name="currentIndex">
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
</property>
<widget class="QWidget" name="tabSourceFiles">
<property name="font">
<font>
@ -1057,8 +1060,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>1091</height>
<width>602</width>
<height>1088</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
@ -3149,6 +3152,7 @@
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
</resources>
<connections>
<connection>

View File

@ -24,9 +24,9 @@
*/
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 1
#define VER_LAMEXP_BUILD 418
#define VER_LAMEXP_SUFFIX Final-1
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_BUILD 421
#define VER_LAMEXP_SUFFIX Alpha-1
/*
* Tools versions

View File

@ -680,6 +680,9 @@ void MainWindow::changeEvent(QEvent *e)
{
ShellIntegration::install();
}
//Force resize, if needed
tabPageChanged(tabWidget->currentIndex());
}
}
@ -1230,11 +1233,43 @@ void MainWindow::tabPageChanged(int idx)
actions.at(i)->setChecked(true);
}
}
if(idx == tabWidget->indexOf(tabSourceFiles))
int initialWidth = this->width();
int maximumWidth = QApplication::desktop()->width();
if(this->isVisible())
{
while(tabWidget->width() < tabWidget->sizeHint().width())
{
int previousWidth = this->width();
this->resize(this->width() + 1, this->height());
if(this->frameGeometry().width() >= maximumWidth) break;
if(this->width() <= previousWidth) break;
}
}
if(idx == tabWidget->indexOf(tabOptions) && scrollArea->widget() && this->isVisible())
{
QApplication::processEvents();
while(scrollArea->viewport()->width() < scrollArea->widget()->width())
{
int previousWidth = this->width();
this->resize(this->width() + 1, this->height());
if(this->frameGeometry().width() >= maximumWidth) break;
if(this->width() <= previousWidth) break;
}
}
else if(idx == tabWidget->indexOf(tabSourceFiles))
{
m_dropNoteLabel->setGeometry(0, 0, sourceFileView->width(), sourceFileView->height());
}
if(initialWidth < this->width())
{
QPoint prevPos = this->pos();
int delta = (this->width() - initialWidth) >> 2;
move(prevPos.x() - delta, prevPos.y());
}
}
/*