2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add TabbedSection which uses the TabbedSelector.

This commit is contained in:
John Preston
2017-04-09 21:06:06 +03:00
parent 647ea44881
commit 891d200e2d
33 changed files with 713 additions and 405 deletions

View File

@@ -339,17 +339,24 @@ void MainWindow::showRightColumn(object_ptr<TWidget> widget) {
}
auto nowRightWidth = _rightColumn ? _rightColumn->width() : 0;
setMinimumWidth(st::windowMinWidth + nowRightWidth);
auto nowWidth = width();
if (!isMaximized()) {
auto desktop = QDesktopWidget().availableGeometry(this);
auto newWidth = qMin(wasWidth + nowRightWidth - wasRightWidth, desktop.width());
auto newLeft = qMin(x(), desktop.x() + desktop.width() - newWidth);
if (x() != newLeft || width() != newWidth) {
setGeometry(newLeft, y(), newWidth, height());
} else {
updateControlsGeometry();
}
tryToExtendWidthBy(wasWidth + nowRightWidth - wasRightWidth - width());
} else {
updateControlsGeometry();
}
}
bool MainWindow::canExtendWidthBy(int addToWidth) {
auto desktop = QDesktopWidget().availableGeometry(this);
return (width() + addToWidth) <= desktop.width();
}
void MainWindow::tryToExtendWidthBy(int addToWidth) {
auto desktop = QDesktopWidget().availableGeometry(this);
auto newWidth = qMin(width() + addToWidth, desktop.width());
auto newLeft = qMin(x(), desktop.x() + desktop.width() - newWidth);
if (x() != newLeft || width() != newWidth) {
setGeometry(newLeft, y(), newWidth, height());
} else {
updateControlsGeometry();
}