-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple prompt on resize #445
Comments
Mind to share example code for this issue? |
Oh, sure, here it is: other than the widgets described above there is a central widget and vbox layout. MainWindow::MainWindow()
: QMainWindow()
, wgtMain(new QWidget(this))
, layout(new QVBoxLayout(wgtMain))
, spltMain(new QSplitter(Qt::Horizontal, wgtMain))
, fileManager(new QTreeView(spltMain))
, fileManagerModel(new QFileSystemModel)
, spltVertical(new QSplitter(Qt::Vertical, spltMain))
, tabWidget(new QTabWidget(spltVertical))
, terminal(new QTermWidget(spltVertical))
{
// ...
terminal->setScrollBarPosition(QTermWidget::ScrollBarRight);
terminal->setColorScheme("GreenOnBlack");
terminal->changeDir(currentDirectory);
terminal->setTerminalSizeHint(false);
// ...
} |
I didn't get duplicated prompts with such a layout. Could you paste a complete example? (ex: main.cpp that can be directly compiled) |
#include <QApplication>
#include <QFileSystemModel>
#include <QHeaderView>
#include <QMainWindow>
#include <QSplitter>
#include <QStackedWidget>
#include <QTabWidget>
#include <QTreeView>
#include <QVBoxLayout>
#include <qtermwidget5/qtermwidget.h>
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow();
private:
QWidget* wgtMain;
QVBoxLayout* layout;
QSplitter* spltMain;
QTreeView* fileManager;
QFileSystemModel* fileManagerModel;
QSplitter* spltVertical;
QTabWidget* tabWidget;
QTermWidget* terminal;
QString currentDir;
};
MainWindow::MainWindow()
: QMainWindow()
, wgtMain(new QWidget(this))
, layout(new QVBoxLayout(wgtMain))
, spltMain(new QSplitter(Qt::Horizontal, wgtMain))
, fileManager(new QTreeView(spltMain))
, fileManagerModel(new QFileSystemModel)
, spltVertical(new QSplitter(Qt::Vertical, spltMain))
, tabWidget(new QTabWidget(spltVertical))
, terminal(new QTermWidget(spltVertical))
, currentDir(QDir::homePath())
{
layout->addWidget(spltMain);
spltVertical->addWidget(tabWidget);
spltVertical->addWidget(terminal);
fileManagerModel->setRootPath(currentDir);
fileManager->setModel(fileManagerModel);
fileManager->setRootIndex(fileManagerModel->index(currentDir));
fileManager->hideColumn(1);
fileManager->hideColumn(2);
fileManager->hideColumn(3);
fileManager->header()->hide();
terminal->setScrollBarPosition(QTermWidget::ScrollBarRight);
terminal->setColorScheme("GreenOnBlack");
terminal->changeDir(currentDir);
terminal->setTerminalSizeHint(false);
setCentralWidget(wgtMain);
}
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "main.moc" |
Thanks, I can reproduce the issue with bash (my default shell is zsh, which seems not affected by this issue). As a record: #include <QApplication>
#include <QFileSystemModel>
#include <QHeaderView>
#include <QMainWindow>
#include <QSplitter>
#include <QStackedWidget>
#include <QTabWidget>
#include <QTreeView>
#include <QVBoxLayout>
#include <qtermwidget5/qtermwidget.h>
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow();
private:
QWidget* wgtMain;
QVBoxLayout* layout;
QSplitter* spltMain;
QTreeView* fileManager;
QFileSystemModel* fileManagerModel;
QSplitter* spltVertical;
QTabWidget* tabWidget;
QTermWidget* terminal;
QString currentDir;
};
MainWindow::MainWindow()
: QMainWindow()
, wgtMain(new QWidget(this))
, layout(new QVBoxLayout(wgtMain))
, spltMain(new QSplitter(Qt::Horizontal, wgtMain))
, fileManager(new QTreeView(spltMain))
, fileManagerModel(new QFileSystemModel)
, spltVertical(new QSplitter(Qt::Vertical, spltMain))
, tabWidget(new QTabWidget(spltVertical))
, terminal(new QTermWidget(0, spltVertical))
, currentDir(QDir::homePath())
{
layout->addWidget(spltMain);
spltVertical->addWidget(tabWidget);
spltVertical->addWidget(terminal);
fileManagerModel->setRootPath(currentDir);
fileManager->setModel(fileManagerModel);
fileManager->setRootIndex(fileManagerModel->index(currentDir));
fileManager->hideColumn(1);
fileManager->hideColumn(2);
fileManager->hideColumn(3);
fileManager->header()->hide();
terminal->setScrollBarPosition(QTermWidget::ScrollBarRight);
terminal->setColorScheme("GreenOnBlack");
terminal->changeDir(currentDir);
terminal->setTerminalSizeHint(false);
terminal->setShellProgram("/bin/bash");
terminal->startShellProgram();
setCentralWidget(wgtMain);
}
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "main.moc" |
uhm, I tried to change the shell to |
Did you set startnow=0 for QTermWidget's constructor like this?
|
Ah nope, I didn't notice that, that worked, thank you. |
When resizing a main window containing a QTermWidget inside a splitter the prompt gets "repeated" multiple times. Like:
Expected Behavior
The widgets resize with the parent window and the original prompt is shown, like normally happens with QTerminal.
Current Behavior
See above.
Context
I'm writing a simple editor with a QTreeView on the left, then a QTabWidget and a QTermWidget on the right.
The QTabWidget and QTermWidget are inside a vertical splitter, the QTreeView and the vertical splitter are inside a
horizontal splitter.
The issue happens also when not resizing the main window but just moving the splitters.
System Information
The text was updated successfully, but these errors were encountered: