- fix: tab icon not correct restore when hide and show a panel
- fix: the hiding state of the tools output panel is not correctly saved
This commit is contained in:
parent
964909a31e
commit
06ee536431
2
NEWS.md
2
NEWS.md
|
@ -5,6 +5,8 @@ Red Panda C++ Version 1.0.9
|
|||
- fix: copy & paste in column mode not correctly handled
|
||||
- fix: crash when project name is selected in the project view and try create new project file
|
||||
- change: panels can be relocated
|
||||
- fix: tab icon not correct restore when hide and show a panel
|
||||
- fix: the hiding state of the tools output panel is not correctly saved
|
||||
|
||||
Red Panda C++ Version 1.0.8
|
||||
- enhancement: auto complete '#undef'
|
||||
|
|
|
@ -185,6 +185,7 @@ SOURCES += \
|
|||
widgets/searchdialog.cpp \
|
||||
widgets/searchresultview.cpp \
|
||||
widgets/shortcutinputedit.cpp \
|
||||
widgets/shrinkabletabwidget.cpp \
|
||||
widgets/signalmessagedialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
|
@ -334,6 +335,7 @@ HEADERS += \
|
|||
widgets/searchdialog.h \
|
||||
widgets/searchresultview.h \
|
||||
widgets/shortcutinputedit.h \
|
||||
widgets/shrinkabletabwidget.h \
|
||||
widgets/signalmessagedialog.h
|
||||
|
||||
FORMS += \
|
||||
|
|
|
@ -316,7 +316,7 @@ void CompilerManager::runProblem(const QString &filename, const QString &argumen
|
|||
OJProblemCasesRunner * execRunner = new OJProblemCasesRunner(filename,arguments,workDir,problemCases);
|
||||
mRunner = execRunner;
|
||||
if (pSettings->executor().enableCaseTimeout())
|
||||
execRunner->setExecTimeout(pSettings->executor().caseTimeout()*1000);
|
||||
execRunner->setExecTimeout(pSettings->executor().caseTimeout());
|
||||
connect(mRunner, &Runner::finished, this ,&CompilerManager::onRunnerTerminated);
|
||||
connect(mRunner, &Runner::finished, pMainWindow ,&MainWindow::onRunProblemFinished);
|
||||
connect(mRunner, &Runner::runErrorOccurred, pMainWindow ,&MainWindow::onRunErrorOccured);
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "customfileiconprovider.h"
|
||||
#include "iconsmanager.h"
|
||||
#include "vcs/gitrepository.h"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CUSTOMFILEICONPROVIDER_H
|
||||
#define CUSTOMFILEICONPROVIDER_H
|
||||
|
||||
|
|
|
@ -1899,12 +1899,13 @@ void MainWindow::openCloseBottomPanel(bool open)
|
|||
// }
|
||||
// mBottomPanelOpenned = open;
|
||||
// QSplitterHandle* handle = ui->splitterMessages->handle(1);
|
||||
// handle->setEnabled(mBottomPanelOpenned);
|
||||
// handle->setEnabled(mBottomPanelOpenned);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::openCloseLeftPanel(bool open)
|
||||
{
|
||||
ui->dockFiles->setVisible(open);
|
||||
ui->dockInfos->setVisible(open);
|
||||
// if (mOpenClosingLeftPanel)
|
||||
// return;
|
||||
// mOpenClosingLeftPanel = true;
|
||||
|
@ -2712,7 +2713,7 @@ void MainWindow::buildEncodingMenu()
|
|||
|
||||
void MainWindow::maximizeEditor()
|
||||
{
|
||||
if (ui->dockFiles->isVisible() || ui->dockMessages->isVisible()) {
|
||||
if (ui->dockInfos->isVisible() || ui->dockMessages->isVisible()) {
|
||||
openCloseBottomPanel(false);
|
||||
openCloseLeftPanel(false);
|
||||
} else {
|
||||
|
@ -4319,6 +4320,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
settings.setShowProblemSet(ui->actionProblem_Set->isChecked());
|
||||
|
||||
settings.setShowIssues(ui->actionIssues->isChecked());
|
||||
settings.setShowCompileLog(ui->actionTools_Output->isChecked());
|
||||
settings.setShowDebug(ui->actionDebug_Window->isChecked());
|
||||
settings.setShowSearch(ui->actionSearch->isChecked());
|
||||
settings.setShowTODO(ui->actionTODO->isChecked());
|
||||
|
@ -4932,7 +4934,7 @@ void MainWindow::on_actionConvert_to_UTF_8_triggered()
|
|||
void MainWindow::on_tabMessages_tabBarClicked(int index)
|
||||
{
|
||||
if (index == ui->tabMessages->currentIndex()) {
|
||||
// openCloseBottomPanel(!mBottomPanelOpenned);
|
||||
ui->tabMessages->toggleShrined();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5364,6 +5366,8 @@ void MainWindow::on_actionForward_triggered()
|
|||
void MainWindow::on_tabInfos_tabBarClicked(int index)
|
||||
{
|
||||
if (index == ui->tabInfos->currentIndex()) {
|
||||
int width = ui->tabInfos->tabBar()->width();
|
||||
ui->tabInfos->toggleShrined();
|
||||
// openCloseLeftPanel(!mLeftPanelOpenned);
|
||||
}
|
||||
}
|
||||
|
@ -5879,6 +5883,12 @@ void MainWindow::showHideInfosTab(QWidget *widget, bool show)
|
|||
int idx = findTabIndex(ui->tabInfos,widget);
|
||||
if (idx>=0) {
|
||||
if (!show) {
|
||||
if (mTabInfosData.contains(widget)) {
|
||||
PTabWidgetInfo info = mTabInfosData[widget];
|
||||
info->icon = ui->tabInfos->tabIcon(idx);
|
||||
info->text = ui->tabInfos->tabText(idx);
|
||||
}
|
||||
|
||||
ui->tabInfos->removeTab(idx);
|
||||
}
|
||||
} else {
|
||||
|
@ -5907,6 +5917,11 @@ void MainWindow::showHideMessagesTab(QWidget *widget, bool show)
|
|||
int idx = findTabIndex(ui->tabMessages,widget);
|
||||
if (idx>=0) {
|
||||
if (!show) {
|
||||
if (mTabMessagesData.contains(widget)) {
|
||||
PTabWidgetInfo info = mTabMessagesData[widget];
|
||||
info->icon = ui->tabMessages->tabIcon(idx);
|
||||
info->text = ui->tabMessages->tabText(idx);
|
||||
}
|
||||
ui->tabMessages->removeTab(idx);
|
||||
}
|
||||
} else {
|
||||
|
@ -7667,7 +7682,7 @@ void MainWindow::on_actionCompiler_Options_triggered()
|
|||
}
|
||||
|
||||
|
||||
void MainWindow::on_dockFiles_dockLocationChanged(const Qt::DockWidgetArea &area)
|
||||
void MainWindow::on_dockInfos_dockLocationChanged(const Qt::DockWidgetArea &area)
|
||||
{
|
||||
switch(area) {
|
||||
case Qt::DockWidgetArea::BottomDockWidgetArea:
|
||||
|
@ -7688,6 +7703,10 @@ void MainWindow::on_dockFiles_dockLocationChanged(const Qt::DockWidgetArea &area
|
|||
|
||||
void MainWindow::on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &area)
|
||||
{
|
||||
qDebug()<<"-----";
|
||||
qDebug()<<ui->dockMessages->minimumSize();
|
||||
qDebug()<<ui->tabMessages->minimumSize();
|
||||
qDebug()<<ui->tabMessages->minimumSizeHint();
|
||||
switch(area) {
|
||||
case Qt::DockWidgetArea::BottomDockWidgetArea:
|
||||
case Qt::DockWidgetArea::TopDockWidgetArea:
|
||||
|
@ -7702,16 +7721,21 @@ void MainWindow::on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &a
|
|||
case Qt::DockWidgetArea::BottomDockWidgetArea:
|
||||
case Qt::DockWidgetArea::TopDockWidgetArea:
|
||||
ui->tabMessages->setTabPosition(QTabWidget::TabPosition::South);
|
||||
ui->debugViews->setTabPosition(QTabWidget::TabPosition::South);
|
||||
break;
|
||||
case Qt::DockWidgetArea::LeftDockWidgetArea:
|
||||
ui->tabMessages->setTabPosition(QTabWidget::TabPosition::West);
|
||||
ui->debugViews->setTabPosition(QTabWidget::TabPosition::West);
|
||||
break;
|
||||
case Qt::DockWidgetArea::RightDockWidgetArea:
|
||||
ui->tabMessages->setTabPosition(QTabWidget::TabPosition::East);
|
||||
ui->debugViews->setTabPosition(QTabWidget::TabPosition::East);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
qDebug()<<ui->dockMessages->minimumSize();
|
||||
qDebug()<<ui->tabMessages->minimumSize();
|
||||
qDebug()<<ui->tabMessages->minimumSizeHint();
|
||||
}
|
||||
|
||||
|
|
|
@ -670,7 +670,7 @@ private slots:
|
|||
|
||||
void on_actionCompiler_Options_triggered();
|
||||
|
||||
void on_dockFiles_dockLocationChanged(const Qt::DockWidgetArea &area);
|
||||
void on_dockInfos_dockLocationChanged(const Qt::DockWidgetArea &area);
|
||||
|
||||
void on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &area);
|
||||
|
||||
|
|
|
@ -433,9 +433,9 @@
|
|||
</attribute>
|
||||
<addaction name="actionCompiler_Options"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="dockFiles">
|
||||
<widget class="QDockWidget" name="dockInfos">
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable</set>
|
||||
<set>QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
|
@ -446,7 +446,7 @@
|
|||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QTabWidget" name="tabInfos">
|
||||
<widget class="ShrinkableTabWidget" name="tabInfos">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -457,7 +457,7 @@
|
|||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
|
@ -829,8 +829,14 @@
|
|||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="dockMessages">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>818</width>
|
||||
<height>235</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable</set>
|
||||
<set>QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
|
@ -841,7 +847,7 @@
|
|||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="QTabWidget" name="tabMessages">
|
||||
<widget class="ShrinkableTabWidget" name="tabMessages">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -852,7 +858,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -1048,7 +1054,7 @@
|
|||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabDebugConsole">
|
||||
<attribute name="title">
|
||||
|
@ -3069,6 +3075,12 @@
|
|||
<extends>QPlainTextEdit</extends>
|
||||
<header location="global">widgets/linenumbertexteditor.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ShrinkableTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header location="global">widgets/shrinkabletabwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
|
|
|
@ -67,6 +67,11 @@ void Settings::endGroup()
|
|||
mSettings.endGroup();
|
||||
}
|
||||
|
||||
void Settings::remove(const QString &key)
|
||||
{
|
||||
mSettings.remove(key);
|
||||
}
|
||||
|
||||
void Settings::saveValue(const QString& group, const QString &key, const QVariant &value) {
|
||||
mSettings.beginGroup(group);
|
||||
auto act = finally([this] {
|
||||
|
@ -288,6 +293,11 @@ void Settings::_Base::endGroup()
|
|||
mSettings->endGroup();
|
||||
}
|
||||
|
||||
void Settings::_Base::remove(const QString &key)
|
||||
{
|
||||
mSettings->remove(key);
|
||||
}
|
||||
|
||||
void Settings::_Base::saveValue(const QString &key, const QVariant &value)
|
||||
{
|
||||
mSettings->saveValue(key,value);
|
||||
|
@ -3177,7 +3187,8 @@ void Settings::Executor::doSave()
|
|||
saveValue("case_editor_font_name",mCaseEditorFontName);
|
||||
saveValue("case_editor_font_size",mCaseEditorFontSize);
|
||||
saveValue("case_editor_font_only_monospaced",mCaseEditorFontOnlyMonospaced);
|
||||
saveValue("case_timeout", mCaseTimeout);
|
||||
saveValue("case_timeout_ms", mCaseTimeout);
|
||||
remove("case_timeout");
|
||||
saveValue("enable_case_timeout", mEnableCaseTimeout);
|
||||
}
|
||||
|
||||
|
@ -3211,7 +3222,11 @@ void Settings::Executor::doLoad()
|
|||
#endif
|
||||
mCaseEditorFontSize = intValue("case_editor_font_size",12);
|
||||
mCaseEditorFontOnlyMonospaced = boolValue("case_editor_font_only_monospaced",true);
|
||||
mCaseTimeout = intValue("case_timeout", 2);
|
||||
int case_timeout = intValue("case_timeout", -1);
|
||||
if (case_timeout>0)
|
||||
mCaseTimeout = case_timeout*1000;
|
||||
else
|
||||
mCaseTimeout = intValue("case_timeout_ms", 2000);
|
||||
mEnableCaseTimeout = boolValue("enable_case_timeout", true);
|
||||
}
|
||||
|
||||
|
@ -4627,26 +4642,6 @@ void Settings::UI::setMainWindowGeometry(const QByteArray &newMainWindowGeometry
|
|||
mMainWindowGeometry = newMainWindowGeometry;
|
||||
}
|
||||
|
||||
bool Settings::UI::bottomPanelOpenned() const
|
||||
{
|
||||
return mBottomPanelOpenned;
|
||||
}
|
||||
|
||||
void Settings::UI::setBottomPanelOpenned(bool newBottomPanelOpenned)
|
||||
{
|
||||
mBottomPanelOpenned = newBottomPanelOpenned;
|
||||
}
|
||||
|
||||
int Settings::UI::bottomPanelHeight() const
|
||||
{
|
||||
return mBottomPanelHeight;
|
||||
}
|
||||
|
||||
void Settings::UI::setBottomPanelHeight(int newBottomPanelHeight)
|
||||
{
|
||||
mBottomPanelHeight = newBottomPanelHeight;
|
||||
}
|
||||
|
||||
int Settings::UI::bottomPanelIndex() const
|
||||
{
|
||||
return mBottomPanelIndex;
|
||||
|
@ -4657,26 +4652,6 @@ void Settings::UI::setBottomPanelIndex(int newBottomPanelIndex)
|
|||
mBottomPanelIndex = newBottomPanelIndex;
|
||||
}
|
||||
|
||||
bool Settings::UI::leftPanelOpenned() const
|
||||
{
|
||||
return mLeftPanelOpenned;
|
||||
}
|
||||
|
||||
void Settings::UI::setLeftPanelOpenned(bool newLeftPanelOpenned)
|
||||
{
|
||||
mLeftPanelOpenned = newLeftPanelOpenned;
|
||||
}
|
||||
|
||||
int Settings::UI::leftPanelWidth() const
|
||||
{
|
||||
return mLeftPanelWidth;
|
||||
}
|
||||
|
||||
void Settings::UI::setLeftPanelWidth(int newLeftPanelWidth)
|
||||
{
|
||||
mLeftPanelWidth = newLeftPanelWidth;
|
||||
}
|
||||
|
||||
int Settings::UI::leftPanelIndex() const
|
||||
{
|
||||
return mLeftPanelIndex;
|
||||
|
@ -5001,11 +4976,7 @@ void Settings::UI::doSave()
|
|||
{
|
||||
saveValue("main_window_state",mMainWindowState);
|
||||
saveValue("main_window_geometry",mMainWindowGeometry);
|
||||
saveValue("bottom_panel_openned",mBottomPanelOpenned);
|
||||
saveValue("bottom_panel_height",mBottomPanelHeight);
|
||||
saveValue("bottom_panel_index",mBottomPanelIndex);
|
||||
saveValue("left_panel_openned",mLeftPanelOpenned);
|
||||
saveValue("left_panel_width",mLeftPanelWidth);
|
||||
saveValue("left_panel_index",mLeftPanelIndex);
|
||||
saveValue("class_browser_sort_alphabetically",mClassBrowserSortAlpha);
|
||||
saveValue("class_browser_sort_by_type",mClassBrowserSortType);
|
||||
|
@ -5049,11 +5020,7 @@ void Settings::UI::doLoad()
|
|||
{
|
||||
mMainWindowState = value("main_window_state",QByteArray()).toByteArray();
|
||||
mMainWindowGeometry = value("main_window_geometry",QByteArray()).toByteArray();
|
||||
mBottomPanelOpenned = boolValue("bottom_panel_openned",false);
|
||||
mBottomPanelHeight = intValue("bottom_panel_height",220);
|
||||
mBottomPanelIndex = intValue("bottom_panel_index",0);
|
||||
mLeftPanelOpenned = boolValue("left_panel_openned",true);
|
||||
mLeftPanelWidth = intValue("left_panel_width",250);
|
||||
mLeftPanelIndex = intValue("left_panel_index",0);
|
||||
mClassBrowserSortAlpha = boolValue("class_browser_sort_alphabetically",true);
|
||||
mClassBrowserSortType = boolValue("class_browser_sort_by_type",true);
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
explicit _Base(Settings* settings, const QString& groupName);
|
||||
void beginGroup();
|
||||
void endGroup();
|
||||
void remove(const QString &key);
|
||||
void saveValue(const QString &key, const QVariant &value);
|
||||
QVariant value(const QString &key, const QVariant& defaultValue);
|
||||
bool boolValue(const QString &key, bool defaultValue);
|
||||
|
@ -930,16 +931,8 @@ public:
|
|||
const QByteArray &mainWindowGeometry() const;
|
||||
void setMainWindowGeometry(const QByteArray &newMainWindowGeometry);
|
||||
|
||||
bool bottomPanelOpenned() const;
|
||||
void setBottomPanelOpenned(bool newBottomPanelOpenned);
|
||||
int bottomPanelHeight() const;
|
||||
void setBottomPanelHeight(int newBottomPanelHeight);
|
||||
int bottomPanelIndex() const;
|
||||
void setBottomPanelIndex(int newBottomPanelIndex);
|
||||
bool leftPanelOpenned() const;
|
||||
void setLeftPanelOpenned(bool newLeftPanelOpenned);
|
||||
int leftPanelWidth() const;
|
||||
void setLeftPanelWidth(int newLeftPanelWidth);
|
||||
int leftPanelIndex() const;
|
||||
void setLeftPanelIndex(int newLeftPanelIndex);
|
||||
|
||||
|
@ -1036,11 +1029,7 @@ public:
|
|||
private:
|
||||
QByteArray mMainWindowState;
|
||||
QByteArray mMainWindowGeometry;
|
||||
bool mBottomPanelOpenned;
|
||||
int mBottomPanelHeight;
|
||||
int mBottomPanelIndex;
|
||||
bool mLeftPanelOpenned;
|
||||
int mLeftPanelWidth;
|
||||
int mLeftPanelIndex;
|
||||
bool mClassBrowserSortAlpha;
|
||||
bool mClassBrowserSortType;
|
||||
|
@ -1348,6 +1337,7 @@ public:
|
|||
Settings& operator= (const Settings&& settings) = delete;
|
||||
void beginGroup(const QString& group);
|
||||
void endGroup();
|
||||
void remove(const QString &key);
|
||||
void saveValue(const QString& group, const QString &key, const QVariant &value);
|
||||
void saveValue(const QString &key, const QVariant &value);
|
||||
QVariant value(const QString& group, const QString &key, const QVariant& defaultValue);
|
||||
|
|
|
@ -87,13 +87,16 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>Sec</string>
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "choosethemedialog.h"
|
||||
#include "ui_choosethemedialog.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CHOOSETHEMEDIALOG_H
|
||||
#define CHOOSETHEMEDIALOG_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "compileargumentswidget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef COMPILEARGUMENTSWIDGET_H
|
||||
#define COMPILEARGUMENTSWIDGET_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "customdisablediconengine.h"
|
||||
|
||||
#include <QImage>
|
||||
|
@ -10,7 +26,7 @@ CustomDisabledIconEngine::CustomDisabledIconEngine()
|
|||
|
||||
}
|
||||
|
||||
void CustomDisabledIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
|
||||
void CustomDisabledIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State /*state*/)
|
||||
{
|
||||
painter->save();
|
||||
painter->setClipRect(rect);
|
||||
|
@ -40,7 +56,7 @@ QIconEngine *CustomDisabledIconEngine::clone() const
|
|||
return eng;
|
||||
}
|
||||
|
||||
QPixmap CustomDisabledIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
|
||||
QPixmap CustomDisabledIconEngine::pixmap(const QSize &/*size*/, QIcon::Mode mode, QIcon::State /*state*/)
|
||||
{
|
||||
if (mode == QIcon::Mode::Disabled)
|
||||
return mDisabledPixmap;
|
||||
|
@ -48,12 +64,12 @@ QPixmap CustomDisabledIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QI
|
|||
return mPixmap;
|
||||
}
|
||||
|
||||
void CustomDisabledIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state)
|
||||
void CustomDisabledIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode /*mode*/, QIcon::State /*state*/)
|
||||
{
|
||||
setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void CustomDisabledIconEngine::addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state)
|
||||
void CustomDisabledIconEngine::addFile(const QString &fileName, const QSize &/*size*/, QIcon::Mode /*mode*/, QIcon::State /*state*/)
|
||||
{
|
||||
setPixmap(QPixmap(fileName));
|
||||
}
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CUSTOMDISABLEDICONENGINE_H
|
||||
#define CUSTOMDISABLEDICONENGINE_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "customfilesystemmodel.h"
|
||||
#include "../vcs/gitmanager.h"
|
||||
#include "../vcs/gitrepository.h"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CUSTOMFILESYSTEMMODEL_H
|
||||
#define CUSTOMFILESYSTEMMODEL_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "infomessagebox.h"
|
||||
#include "ui_infomessagebox.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef INFOMESSAGEBOX_H
|
||||
#define INFOMESSAGEBOX_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "linenumbertexteditor.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef LINENUMBERTEXTEDITOR_H
|
||||
#define LINENUMBERTEXTEDITOR_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "newclassdialog.h"
|
||||
#include "ui_newclassdialog.h"
|
||||
#include "../iconsmanager.h"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef NEWCLASSDIALOG_H
|
||||
#define NEWCLASSDIALOG_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "newheaderdialog.h"
|
||||
#include "ui_newheaderdialog.h"
|
||||
#include "../iconsmanager.h"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef NEWHEADERDIALOG_H
|
||||
#define NEWHEADERDIALOG_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "newprojectunitdialog.h"
|
||||
#include "ui_newprojectunitdialog.h"
|
||||
#include "../iconsmanager.h"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef NEWPROJECTUNITDIALOG_H
|
||||
#define NEWPROJECTUNITDIALOG_H
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ QVariant OJProblemModel::data(const QModelIndex &index, int role) const
|
|||
POJProblemCase problemCase = mProblem->cases[index.row()];
|
||||
if (problemCase->testState == ProblemCaseTestState::Passed
|
||||
|| problemCase->testState == ProblemCaseTestState::Failed)
|
||||
return problemCase->runningTime/1000.0;
|
||||
return problemCase->runningTime;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ QVariant OJProblemModel::headerData(int section, Qt::Orientation orientation, in
|
|||
case 0:
|
||||
return tr("Name");
|
||||
case 1:
|
||||
return tr("Time(sec)");
|
||||
return tr("Time(ms)");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "shortcutinputedit.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SHORTCUTINPUTEDIT_H
|
||||
#define SHORTCUTINPUTEDIT_H
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "shrinkabletabwidget.h"
|
||||
#include <QTabBar>
|
||||
#include <QDebug>
|
||||
|
||||
ShrinkableTabWidget::ShrinkableTabWidget(QWidget *parent):QTabWidget(parent),
|
||||
mShrinked(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ShrinkableTabWidget::setShrinked(bool shrinked)
|
||||
{
|
||||
if (!mShrinked) {
|
||||
mBeforeShrinkSize = size();
|
||||
}
|
||||
mShrinked = shrinked;
|
||||
switch(this->tabPosition()) {
|
||||
case QTabWidget::East:
|
||||
case QTabWidget::West:
|
||||
if (mShrinked) {
|
||||
this->setFixedWidth(tabBar()->width());
|
||||
} else {
|
||||
this->setMaximumWidth(QWIDGETSIZE_MAX);
|
||||
}
|
||||
break;
|
||||
case QTabWidget::North:
|
||||
case QTabWidget::South:
|
||||
if (mShrinked) {
|
||||
this->setFixedHeight(tabBar()->height());
|
||||
} else {
|
||||
this->setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShrinkableTabWidget::toggleShrined()
|
||||
{
|
||||
setShrinked(!mShrinked);
|
||||
}
|
||||
|
||||
QSize ShrinkableTabWidget::sizeHint() const
|
||||
{
|
||||
return QTabWidget::sizeHint();
|
||||
}
|
||||
|
||||
QSize ShrinkableTabWidget::minimumSizeHint() const
|
||||
{
|
||||
QSize size=QTabWidget::minimumSizeHint();
|
||||
switch(this->tabPosition()) {
|
||||
case QTabWidget::East:
|
||||
case QTabWidget::West:
|
||||
size.setWidth(tabBar()->width());
|
||||
break;
|
||||
case QTabWidget::North:
|
||||
case QTabWidget::South:
|
||||
size.setHeight(tabBar()->height());
|
||||
}
|
||||
// qDebug()<<"min size hint()"<<size;
|
||||
// qDebug()<<"mininum size"<<minimumSize();
|
||||
return size;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SHRINKABLETABWIDGET_H
|
||||
#define SHRINKABLETABWIDGET_H
|
||||
|
||||
#include <QTabWidget>
|
||||
|
||||
class ShrinkableTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShrinkableTabWidget(QWidget* parent=nullptr);
|
||||
|
||||
void setShrinked(bool shrinked);
|
||||
void toggleShrined();
|
||||
|
||||
// QWidget interface
|
||||
public:
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
private:
|
||||
bool mShrinked;
|
||||
QSize mBeforeShrinkSize;
|
||||
};
|
||||
|
||||
#endif // SHRINKABLETABWIDGET_H
|
Loading…
Reference in New Issue