[konsole] [Bug 477700] Terminal shrinks when creating new/switching tabs on x11
Milian Wolff
bugzilla_noreply at kde.org
Wed Jan 24 11:16:37 GMT 2024
https://bugs.kde.org/show_bug.cgi?id=477700
--- Comment #20 from Milian Wolff <mail at milianw.de> ---
This code here is enough for me to trigger the behavior - it clearly isn't
konsole specific at all:
```
#include <QApplication>
#include <QTabBar>
#include <QShortcut>
#include <QDebug>
#include <QMainWindow>
#include <QVBoxLayout>
#include <QTabWidget>
#include <QTimer>
#include <QWindow>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QMainWindow window;
auto center = new QTabWidget;
window.setCentralWidget(center);
auto tab = center->tabBar();
auto addTab = [tab]() {
static int counter = 0;
tab->addTab(QString::number(counter++));
qWarning() << "add" << counter;
};
addTab();
auto removeTab = [tab]() {
tab->removeTab(tab->currentIndex());
qWarning() << "rem";
};
auto newTab = new QShortcut(QKeySequence::New, tab);
qWarning() << newTab->key();
newTab->setContext(Qt::ApplicationShortcut);
QObject::connect(newTab, &QShortcut::activated, tab, addTab);
auto closeTab = new QShortcut(QKeySequence::Close, tab);
qWarning() << closeTab->key();
closeTab->setContext(Qt::ApplicationShortcut);
QObject::connect(closeTab, &QShortcut::activated, tab, removeTab);
window.resize(600, 400);
window.show();
QObject::connect(window.windowHandle(), &QWindow::heightChanged, &window,
[&](int height) {
qWarning() << "height changed:" << height;
});
if (app.arguments().contains("--auto")) {
auto timer = new QTimer(tab);
timer->setInterval(100);
QObject::connect(timer, &QTimer::timeout, &app, [&]() {
static int i = 0;
if ((i % 2) == 0)
removeTab();
else
addTab();
++i;
});
timer->start();
}
return app.exec();
}
```
Example output when run:
```
./tab --auto
0.000 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:25]: add 1
0.000 warning: main[/home/milian/projects/bugs/tab/tab.cpp:35]:
QKeySequence("Ctrl+N")
0.000 warning: main[/home/milian/projects/bugs/tab/tab.cpp:40]:
QKeySequence("Ctrl+W")
0.040 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
399
0.111 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:31]: rem
0.207 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:25]: add 2
0.210 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
398
0.302 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:31]: rem
0.305 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
397
0.397 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:25]: add 3
0.492 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:31]: rem
0.494 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
396
0.587 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:25]: add 4
0.590 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
395
0.686 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:31]: rem
0.787 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:25]: add 5
0.791 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
394
0.887 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:31]: rem
0.890 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:48]: height changed:
393
0.987 warning: main(int,
char**)::<lambda[/home/milian/projects/bugs/tab/tab.cpp:25]: add 6
```
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the konsole-devel
mailing list