ui: subwindow when resize mainwindow

* disable drop in qtlineedit
    fixes bug where when file is dropped in the lineedit with text,
    the the file will be added as text midst the existing text
* move message to start from script before layout loading so it will load right
(only when started without script on linux)
* center subwindow when mainwindow size changes
This commit is contained in:
Andreas Stallinger
2017-06-08 20:42:32 +02:00
parent 699de2ee0a
commit 419a2e27ba
8 changed files with 75 additions and 51 deletions
+16 -10
View File
@@ -101,14 +101,21 @@ QtMainWindow::QtMainWindow()
, m_showDockWidgetTitleBars(true)
, m_windowStack(this)
{
setObjectName("QtMainWindow");
setObjectName("QtMainWindow");
setCentralWidget(nullptr);
setDockNestingEnabled(true);
setWindowIcon(QIcon((ResourcePaths::getGuiPath().str() + "icon/logo_1024_1024.png").c_str()));
setWindowFlags(Qt::Widget);
QApplication* app = dynamic_cast<QApplication*>(QCoreApplication::instance());
#ifdef __linux__
if (std::getenv("SOURCETRAIL_VIA_SCRIPT") == nullptr)
{
QMessageBox::warning(this, "Run Sourcetrail via Script", "Please run Sourcetrail via Sourcetrail.sh");
}
#endif
QApplication* app = dynamic_cast<QApplication*>(QCoreApplication::instance());
app->installEventFilter(new MouseReleaseFilter(this));
app->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("main.css"))).c_str());
@@ -125,13 +132,6 @@ QtMainWindow::QtMainWindow()
// Need to call loadLayout here for right DockWidget size on Linux
// Seconde call is in Application.cpp
loadLayout();
#ifdef __linux__
if (std::getenv("SOURCETRAIL_VIA_SCRIPT") == nullptr)
{
QMessageBox::warning(this, "Run Sourcetrail via Script", "Please run Sourcetrail via Sourcetrail.sh");
}
#endif
}
QtMainWindow::~QtMainWindow()
@@ -323,7 +323,13 @@ void QtMainWindow::closeEvent(QCloseEvent* event)
{
log->setEnabled(false);
}
MessageWindowClosed().dispatch();
MessageWindowClosed().dispatch();
}
void QtMainWindow::resizeEvent(QResizeEvent *event)
{
m_windowStack.centerSubWindows();
QMainWindow::resizeEvent(event);
}
void QtMainWindow::about()