Merge branch 'master' into gdbmi
This commit is contained in:
commit
88bb3b25cb
8
NEWS.md
8
NEWS.md
|
@ -1,3 +1,11 @@
|
||||||
|
Version 0.8.6 For Dev-C++ 7 Beta
|
||||||
|
- enhancement: greatly reduces memory usage for symbol parsing ( memory needed for bits/stdc++.h reduced from 150m+ to 80m+)
|
||||||
|
- fix: currect compiler set not correctly updated when switch between normal file and project file
|
||||||
|
|
||||||
|
Version 0.8.5 For Dev-C++ 7 Beta
|
||||||
|
- enhancement: use lighter color to draw menu seperators
|
||||||
|
- enhancement: differentiate selected and unselected tab bars
|
||||||
|
|
||||||
Version 0.8.4 For Dev-C++ 7 Beta
|
Version 0.8.4 For Dev-C++ 7 Beta
|
||||||
- enhancement: auto save/load the default open folder in the configuration file
|
- enhancement: auto save/load the default open folder in the configuration file
|
||||||
- fix: shouldn't auto add '()' when char succeeding the completed function name is '('
|
- fix: shouldn't auto add '()' when char succeeding the completed function name is '('
|
||||||
|
|
|
@ -91,7 +91,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
ui->toolbarCompilerSet->addWidget(mCompilerSet);
|
ui->toolbarCompilerSet->addWidget(mCompilerSet);
|
||||||
connect(mCompilerSet,QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(mCompilerSet,QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &MainWindow::onCompilerSetChanged);
|
this, &MainWindow::onCompilerSetChanged);
|
||||||
updateCompilerSet();
|
//updateCompilerSet();
|
||||||
|
|
||||||
mCompilerManager = new CompilerManager(this);
|
mCompilerManager = new CompilerManager(this);
|
||||||
mDebugger = new Debugger(this);
|
mDebugger = new Debugger(this);
|
||||||
|
@ -399,7 +399,7 @@ void MainWindow::updateEditorActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCompileActions();
|
updateCompileActions();
|
||||||
|
updateCompilerSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateProjectActions()
|
void MainWindow::updateProjectActions()
|
||||||
|
|
|
@ -61,9 +61,9 @@ void CppParser::addHardDefineByLine(const QString &line)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line.startsWith('#')) {
|
if (line.startsWith('#')) {
|
||||||
mPreprocessor.addDefineByLine(line.mid(1).trimmed(), true);
|
mPreprocessor.addHardDefineByLine(line.mid(1).trimmed());
|
||||||
} else {
|
} else {
|
||||||
mPreprocessor.addDefineByLine(line, true);
|
mPreprocessor.addHardDefineByLine(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1297,6 +1297,18 @@ int CppParser::skipBracket(int startAt)
|
||||||
return startAt;
|
return startAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppParser::internalClear()
|
||||||
|
{
|
||||||
|
mCurrentScope.clear();
|
||||||
|
mCurrentClassScope.clear();
|
||||||
|
mIndex = 0;
|
||||||
|
mClassScope = StatementClassScope::scsNone;
|
||||||
|
mSkipList.clear();
|
||||||
|
mBlockBeginSkips.clear();
|
||||||
|
mBlockEndSkips.clear();
|
||||||
|
mInlineNamespaceEndSkips.clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool CppParser::checkForCatchBlock()
|
bool CppParser::checkForCatchBlock()
|
||||||
{
|
{
|
||||||
// return mIndex < mTokenizer.tokenCount() &&
|
// return mIndex < mTokenizer.tokenCount() &&
|
||||||
|
@ -3127,33 +3139,37 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
mPreprocessor.setScanOptions(mParseGlobalHeaders, mParseLocalHeaders);
|
mPreprocessor.setScanOptions(mParseGlobalHeaders, mParseLocalHeaders);
|
||||||
mPreprocessor.preprocess(fileName, buffer);
|
mPreprocessor.preprocess(fileName, buffer);
|
||||||
|
|
||||||
|
QStringList preprocessResult = mPreprocessor.result();
|
||||||
// Tokenize the preprocessed buffer file
|
//reduce memory usage
|
||||||
mTokenizer.tokenize(mPreprocessor.result());
|
mPreprocessor.clearResult();
|
||||||
if (mTokenizer.tokenCount() == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Process the token list
|
|
||||||
mCurrentScope.clear();
|
|
||||||
mCurrentClassScope.clear();
|
|
||||||
mIndex = 0;
|
|
||||||
mClassScope = StatementClassScope::scsNone;
|
|
||||||
mSkipList.clear();
|
|
||||||
mBlockBeginSkips.clear();
|
|
||||||
mBlockEndSkips.clear();
|
|
||||||
mInlineNamespaceEndSkips.clear();
|
|
||||||
while(true) {
|
|
||||||
if (!handleStatement())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// StringsToFile(mPreprocessor.result(),"f:\\preprocess.txt");
|
// StringsToFile(mPreprocessor.result(),"f:\\preprocess.txt");
|
||||||
// mPreprocessor.dumpDefinesTo("f:\\defines.txt");
|
// mPreprocessor.dumpDefinesTo("f:\\defines.txt");
|
||||||
// mPreprocessor.dumpIncludesListTo("f:\\includes.txt");
|
// mPreprocessor.dumpIncludesListTo("f:\\includes.txt");
|
||||||
// mStatementList.dump("f:\\stats.txt");
|
#endif
|
||||||
|
|
||||||
|
// Tokenize the preprocessed buffer file
|
||||||
|
mTokenizer.tokenize(preprocessResult);
|
||||||
|
//reduce memory usage
|
||||||
|
preprocessResult.clear();
|
||||||
|
if (mTokenizer.tokenCount() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Process the token list
|
||||||
|
internalClear();
|
||||||
|
while(true) {
|
||||||
|
if (!handleStatement())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//reduce memory usage
|
||||||
|
internalClear();
|
||||||
|
#ifdef QT_DEBUG
|
||||||
// mTokenizer.dumpTokens("f:\\tokens.txt");
|
// mTokenizer.dumpTokens("f:\\tokens.txt");
|
||||||
|
// mStatementList.dump("f:\\stats.txt");
|
||||||
// mStatementList.dumpAll("f:\\all-stats.txt");
|
// mStatementList.dumpAll("f:\\all-stats.txt");
|
||||||
#endif
|
#endif
|
||||||
|
//reduce memory usage
|
||||||
|
mTokenizer.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,9 @@ private:
|
||||||
void removeScopeLevel(int line); // removes level
|
void removeScopeLevel(int line); // removes level
|
||||||
int skipBraces(int startAt);
|
int skipBraces(int startAt);
|
||||||
int skipBracket(int startAt);
|
int skipBracket(int startAt);
|
||||||
|
|
||||||
|
void internalClear();
|
||||||
|
|
||||||
bool checkForCatchBlock();
|
bool checkForCatchBlock();
|
||||||
bool checkForEnum();
|
bool checkForEnum();
|
||||||
bool checkForForBlock();
|
bool checkForForBlock();
|
||||||
|
|
|
@ -22,6 +22,18 @@ void CppPreprocessor::clear()
|
||||||
mCurrentIncludes.reset();
|
mCurrentIncludes.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::clearResult()
|
||||||
|
{
|
||||||
|
mFileName.clear();
|
||||||
|
mBuffer.clear();
|
||||||
|
mResult.clear();
|
||||||
|
mCurrentIncludes = nullptr;
|
||||||
|
mIncludes.clear(); // stack of files we've stepped into. last one is current file, first one is source file
|
||||||
|
mBranchResults.clear();// stack of branch results (boolean). last one is current branch, first one is outermost branch
|
||||||
|
mDefines.clear(); // working set, editable
|
||||||
|
mProcessed.clear(); // dictionary to save filename already processed
|
||||||
|
}
|
||||||
|
|
||||||
void CppPreprocessor::addDefineByParts(const QString &name, const QString &args, const QString &value, bool hardCoded)
|
void CppPreprocessor::addDefineByParts(const QString &name, const QString &args, const QString &value, bool hardCoded)
|
||||||
{
|
{
|
||||||
// Check for duplicates
|
// Check for duplicates
|
||||||
|
@ -91,6 +103,11 @@ void CppPreprocessor::getDefineParts(const QString &input, QString &name, QStrin
|
||||||
value = removeGCCAttributes(s.mid(i+1).trimmed());
|
value = removeGCCAttributes(s.mid(i+1).trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::addHardDefineByLine(const QString &line)
|
||||||
|
{
|
||||||
|
addDefineByLine(line,true);
|
||||||
|
}
|
||||||
|
|
||||||
void CppPreprocessor::addDefineByLine(const QString &line, bool hardCoded)
|
void CppPreprocessor::addDefineByLine(const QString &line, bool hardCoded)
|
||||||
{
|
{
|
||||||
// Remove define
|
// Remove define
|
||||||
|
|
|
@ -46,17 +46,12 @@ public:
|
||||||
|
|
||||||
explicit CppPreprocessor();
|
explicit CppPreprocessor();
|
||||||
void clear();
|
void clear();
|
||||||
void addDefineByParts(const QString& name, const QString& args,
|
void clearResult();
|
||||||
const QString& value, bool hardCoded);
|
|
||||||
void getDefineParts(const QString& input, QString &name, QString &args, QString &value);
|
void getDefineParts(const QString& input, QString &name, QString &args, QString &value);
|
||||||
void addDefineByLine(const QString& line, bool hardCoded);
|
void addHardDefineByLine(const QString& line);
|
||||||
PDefine getDefine(const QString& name);
|
|
||||||
PDefine getHardDefine(const QString& name);
|
|
||||||
void reset(); //reset but don't clear generated defines
|
void reset(); //reset but don't clear generated defines
|
||||||
void resetDefines();
|
|
||||||
void setScanOptions(bool parseSystem, bool parseLocal);
|
void setScanOptions(bool parseSystem, bool parseLocal);
|
||||||
void preprocess(const QString& fileName, QStringList buffer = QStringList());
|
void preprocess(const QString& fileName, QStringList buffer = QStringList());
|
||||||
void invalidDefinesInFile(const QString& fileName);
|
|
||||||
|
|
||||||
void dumpDefinesTo(const QString& fileName) const;
|
void dumpDefinesTo(const QString& fileName) const;
|
||||||
void dumpIncludesListTo(const QString& fileName) const;
|
void dumpIncludesListTo(const QString& fileName) const;
|
||||||
|
@ -97,7 +92,7 @@ private:
|
||||||
void expandMacro(const QString& line, QString& newLine, QString& word, int& i, int depth);
|
void expandMacro(const QString& line, QString& newLine, QString& word, int& i, int depth);
|
||||||
QString removeGCCAttributes(const QString& line);
|
QString removeGCCAttributes(const QString& line);
|
||||||
void removeGCCAttribute(const QString&line, QString& newLine, int &i, const QString& word);
|
void removeGCCAttribute(const QString&line, QString& newLine, int &i, const QString& word);
|
||||||
|
PDefine getDefine(const QString& name);
|
||||||
// current file stuff
|
// current file stuff
|
||||||
PParsedFile getInclude(int index);
|
PParsedFile getInclude(int index);
|
||||||
void openInclude(const QString& fileName, QStringList bufferedText=QStringList());
|
void openInclude(const QString& fileName, QStringList bufferedText=QStringList());
|
||||||
|
@ -110,6 +105,12 @@ private:
|
||||||
// include stuff
|
// include stuff
|
||||||
PFileIncludes getFileIncludesEntry(const QString& FileName);
|
PFileIncludes getFileIncludesEntry(const QString& FileName);
|
||||||
void addDefinesInFile(const QString& fileName);
|
void addDefinesInFile(const QString& fileName);
|
||||||
|
void resetDefines();
|
||||||
|
void addDefineByParts(const QString& name, const QString& args,
|
||||||
|
const QString& value, bool hardCoded);
|
||||||
|
void addDefineByLine(const QString& line, bool hardCoded);
|
||||||
|
PDefine getHardDefine(const QString& name);
|
||||||
|
void invalidDefinesInFile(const QString& fileName);
|
||||||
|
|
||||||
void parseArgs(PDefine define);
|
void parseArgs(PDefine define);
|
||||||
QList<PDefineArgToken> tokenizeValue(const QString& value);
|
QList<PDefineArgToken> tokenizeValue(const QString& value);
|
||||||
|
@ -181,24 +182,26 @@ private:
|
||||||
QStringList mResult;
|
QStringList mResult;
|
||||||
PFileIncludes mCurrentIncludes;
|
PFileIncludes mCurrentIncludes;
|
||||||
int mPreProcIndex;
|
int mPreProcIndex;
|
||||||
QHash<QString,PFileIncludes> mIncludesList;
|
|
||||||
DefineMap mHardDefines; // set by "cpp -dM -E -xc NUL"
|
|
||||||
DefineMap mDefines; // working set, editable
|
|
||||||
QHash<QString, PDefineMap> mFileDefines; //dictionary to save defines for each headerfile;
|
|
||||||
QList<PParsedFile> mIncludes; // stack of files we've stepped into. last one is current file, first one is source file
|
QList<PParsedFile> mIncludes; // stack of files we've stepped into. last one is current file, first one is source file
|
||||||
QList<bool> mBranchResults;// stack of branch results (boolean). last one is current branch, first one is outermost branch
|
QList<bool> mBranchResults;// stack of branch results (boolean). last one is current branch, first one is outermost branch
|
||||||
//{ List of current compiler set's include path}
|
DefineMap mDefines; // working set, editable
|
||||||
QSet<QString> mIncludePaths;
|
QSet<QString> mProcessed; // dictionary to save filename already processed
|
||||||
|
|
||||||
|
//used by parser even preprocess finished
|
||||||
|
DefineMap mHardDefines; // set by "cpp -dM -E -xc NUL"
|
||||||
|
QHash<QString,PFileIncludes> mIncludesList;
|
||||||
|
QHash<QString, PDefineMap> mFileDefines; //dictionary to save defines for each headerfile;
|
||||||
//{ List of current project's include path }
|
//{ List of current project's include path }
|
||||||
QSet<QString> mProjectIncludePaths;
|
QSet<QString> mProjectIncludePaths;
|
||||||
//we also need include paths in order (for #include_next)
|
//we also need include paths in order (for #include_next)
|
||||||
QList<QString> mIncludePathList;
|
QList<QString> mIncludePathList;
|
||||||
QList<QString> mProjectIncludePathList;
|
QList<QString> mProjectIncludePathList;
|
||||||
|
//{ List of current compiler set's include path}
|
||||||
|
QSet<QString> mIncludePaths;
|
||||||
|
|
||||||
bool mParseSystem;
|
bool mParseSystem;
|
||||||
bool mParseLocal;
|
bool mParseLocal;
|
||||||
QSet<QString> mScannedFiles;
|
QSet<QString> mScannedFiles;
|
||||||
QSet<QString> mProcessed; // dictionary to save filename already processed
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPPPREPROCESSOR_H
|
#endif // CPPPREPROCESSOR_H
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#define DEVCPP_VERSION "beta.0.8.4"
|
#define DEVCPP_VERSION "beta.0.8.5"
|
||||||
|
|
||||||
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
@ -894,6 +894,7 @@ void CodeCompletionPopup::hideEvent(QHideEvent *event)
|
||||||
mIncludedFiles.clear();
|
mIncludedFiles.clear();
|
||||||
mUsings.clear();
|
mUsings.clear();
|
||||||
mAddedStatements.clear();
|
mAddedStatements.clear();
|
||||||
|
mParser = nullptr;
|
||||||
QWidget::hideEvent(event);
|
QWidget::hideEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -793,3 +793,161 @@ QIcon DarkFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOpt
|
||||||
|
|
||||||
return QProxyStyle::standardIcon(standardIcon, option, widget);
|
return QProxyStyle::standardIcon(standardIcon, option, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DarkFusionStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter,
|
||||||
|
const QWidget *widget) const
|
||||||
|
{
|
||||||
|
QRect rect = option->rect;
|
||||||
|
QColor outline = calcOutline(option->palette);
|
||||||
|
QColor highlightedOutline = calcHighlightedOutline(option->palette);
|
||||||
|
QColor shadow = calcDarkShade();
|
||||||
|
|
||||||
|
|
||||||
|
switch (element) {
|
||||||
|
case CE_MenuItem:
|
||||||
|
painter->save();
|
||||||
|
// Draws one item in a popup menu.
|
||||||
|
if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
|
||||||
|
QColor highlightOutline = highlightedOutline;
|
||||||
|
QColor highlight = option->palette.highlight().color();
|
||||||
|
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
|
||||||
|
int w = 0;
|
||||||
|
const int margin = int(QStyleHelper::dpiScaled(5, option));
|
||||||
|
if (!menuItem->text.isEmpty()) {
|
||||||
|
painter->setFont(menuItem->font);
|
||||||
|
proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter,
|
||||||
|
menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
|
||||||
|
QPalette::Text);
|
||||||
|
w = menuItem->fontMetrics.horizontalAdvance(menuItem->text) + margin;
|
||||||
|
}
|
||||||
|
painter->setPen(shadow.darker(150));
|
||||||
|
bool reverse = menuItem->direction == Qt::RightToLeft;
|
||||||
|
painter->drawLine(menuItem->rect.left() + margin + (reverse ? 0 : w), menuItem->rect.center().y(),
|
||||||
|
menuItem->rect.right() - margin - (reverse ? w : 0), menuItem->rect.center().y());
|
||||||
|
painter->restore();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QProxyStyle::drawControl(element, option, painter, widget);
|
||||||
|
break;
|
||||||
|
case CE_TabBarTabShape:
|
||||||
|
painter->save();
|
||||||
|
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
|
||||||
|
|
||||||
|
bool rtlHorTabs = (tab->direction == Qt::RightToLeft
|
||||||
|
&& (tab->shape == QTabBar::RoundedNorth
|
||||||
|
|| tab->shape == QTabBar::RoundedSouth));
|
||||||
|
bool selected = tab->state & State_Selected;
|
||||||
|
bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
|
||||||
|
|| (rtlHorTabs
|
||||||
|
&& tab->position == QStyleOptionTab::Beginning));
|
||||||
|
bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
|
||||||
|
int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget);
|
||||||
|
rect = option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0);
|
||||||
|
|
||||||
|
QRect r2(rect);
|
||||||
|
int x1 = r2.left();
|
||||||
|
int x2 = r2.right();
|
||||||
|
int y1 = r2.top();
|
||||||
|
int y2 = r2.bottom();
|
||||||
|
|
||||||
|
painter->setPen(calcInnerContrastLine());
|
||||||
|
|
||||||
|
QTransform rotMatrix;
|
||||||
|
bool flip = false;
|
||||||
|
painter->setPen(shadow);
|
||||||
|
|
||||||
|
switch (tab->shape) {
|
||||||
|
case QTabBar::RoundedNorth:
|
||||||
|
break;
|
||||||
|
case QTabBar::RoundedSouth:
|
||||||
|
rotMatrix.rotate(180);
|
||||||
|
rotMatrix.translate(0, -rect.height() + 1);
|
||||||
|
rotMatrix.scale(-1, 1);
|
||||||
|
painter->setTransform(rotMatrix, true);
|
||||||
|
break;
|
||||||
|
case QTabBar::RoundedWest:
|
||||||
|
rotMatrix.rotate(180 + 90);
|
||||||
|
rotMatrix.scale(-1, 1);
|
||||||
|
flip = true;
|
||||||
|
painter->setTransform(rotMatrix, true);
|
||||||
|
break;
|
||||||
|
case QTabBar::RoundedEast:
|
||||||
|
rotMatrix.rotate(90);
|
||||||
|
rotMatrix.translate(0, - rect.width() + 1);
|
||||||
|
flip = true;
|
||||||
|
painter->setTransform(rotMatrix, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
painter->restore();
|
||||||
|
QCommonStyle::drawControl(element, tab, painter, widget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flip) {
|
||||||
|
QRect tmp = rect;
|
||||||
|
rect = QRect(tmp.y(), tmp.x(), tmp.height(), tmp.width());
|
||||||
|
int temp = x1;
|
||||||
|
x1 = y1;
|
||||||
|
y1 = temp;
|
||||||
|
temp = x2;
|
||||||
|
x2 = y2;
|
||||||
|
y2 = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
painter->translate(0.5, 0.5);
|
||||||
|
|
||||||
|
QColor tabFrameColor = tab->features & QStyleOptionTab::HasFrame ?
|
||||||
|
calcTabFrameColor(option->palette) :
|
||||||
|
option->palette.window().color();
|
||||||
|
|
||||||
|
QLinearGradient fillGradient(rect.topLeft(), rect.bottomLeft());
|
||||||
|
QLinearGradient outlineGradient(rect.topLeft(), rect.bottomLeft());
|
||||||
|
QPen outlinePen = outline.lighter(110);
|
||||||
|
if (selected) {
|
||||||
|
fillGradient.setColorAt(0, tabFrameColor.lighter(250));
|
||||||
|
// QColor highlight = option->palette.highlight().color();
|
||||||
|
// if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) {
|
||||||
|
// fillGradient.setColorAt(0, highlight.lighter(130));
|
||||||
|
// outlineGradient.setColorAt(0, highlight.darker(130));
|
||||||
|
// fillGradient.setColorAt(0.14, highlight);
|
||||||
|
// outlineGradient.setColorAt(0.14, highlight.darker(130));
|
||||||
|
// fillGradient.setColorAt(0.1401, tabFrameColor);
|
||||||
|
// outlineGradient.setColorAt(0.1401, highlight.darker(130));
|
||||||
|
// }
|
||||||
|
fillGradient.setColorAt(0.85, tabFrameColor.lighter(150));
|
||||||
|
fillGradient.setColorAt(1, tabFrameColor);
|
||||||
|
outlineGradient.setColorAt(1, outline);
|
||||||
|
outlinePen = QPen(outlineGradient, 1);
|
||||||
|
} else {
|
||||||
|
fillGradient.setColorAt(0, tabFrameColor.darker(108));
|
||||||
|
fillGradient.setColorAt(0.85, tabFrameColor.darker(108));
|
||||||
|
fillGradient.setColorAt(1, tabFrameColor.darker(116));
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect drawRect = rect.adjusted(0, selected ? 0 : 2, 0, 3);
|
||||||
|
painter->setPen(outlinePen);
|
||||||
|
painter->save();
|
||||||
|
painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3));
|
||||||
|
painter->setBrush(fillGradient);
|
||||||
|
painter->drawRoundedRect(drawRect.adjusted(0, 0, -1, -1), 2.0, 2.0);
|
||||||
|
painter->setBrush(Qt::NoBrush);
|
||||||
|
painter->setPen(calcInnerContrastLine());
|
||||||
|
painter->drawRoundedRect(drawRect.adjusted(1, 1, -2, -1), 2.0, 2.0);
|
||||||
|
painter->restore();
|
||||||
|
|
||||||
|
if (selected) {
|
||||||
|
painter->fillRect(rect.left() + 1, rect.bottom() - 1, rect.width() - 2, rect.bottom() - 1, tabFrameColor);
|
||||||
|
painter->fillRect(QRect(rect.bottomRight() + QPoint(-2, -1), QSize(1, 1)), calcInnerContrastLine());
|
||||||
|
painter->fillRect(QRect(rect.bottomLeft() + QPoint(0, -1), QSize(1, 1)), calcInnerContrastLine());
|
||||||
|
painter->fillRect(QRect(rect.bottomRight() + QPoint(-1, -1), QSize(1, 1)), calcInnerContrastLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
painter->restore();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QProxyStyle::drawControl(element, option, painter, widget);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ public:
|
||||||
// QStyle interface
|
// QStyle interface
|
||||||
public:
|
public:
|
||||||
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override;
|
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override;
|
||||||
|
void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter,
|
||||||
|
const QWidget *widget) const override;
|
||||||
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
|
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
|
||||||
const QWidget *widget = nullptr) const override;
|
const QWidget *widget = nullptr) const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -227,6 +227,7 @@ void HeaderCompletionPopup::hideEvent(QHideEvent *)
|
||||||
{
|
{
|
||||||
mCompletionList.clear();
|
mCompletionList.clear();
|
||||||
mFullCompletionList.clear();
|
mFullCompletionList.clear();
|
||||||
|
mParser = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HeaderCompletionPopup::event(QEvent *event)
|
bool HeaderCompletionPopup::event(QEvent *event)
|
||||||
|
|
Loading…
Reference in New Issue