Merge pull request 'fix: eliminate window flickering and Sketcher icon clipping' (#172) from fix/ui-flicker-and-icon-clipping into main
Some checks failed
Build and Test / build (push) Has been cancelled
Sync Silo Server Docs / sync (push) Successful in 28s

Reviewed-on: #172
This commit was merged in pull request #172.
This commit is contained in:
2026-02-11 01:29:27 +00:00
3 changed files with 22 additions and 16 deletions

View File

@@ -2541,10 +2541,18 @@ void MainWindow::changeEvent(QEvent* e)
}
}
static void setStatusBarForeground(QStatusBar* bar, const QColor& color)
{
QPalette pal = bar->palette();
pal.setColor(QPalette::WindowText, color);
bar->setPalette(pal);
}
void MainWindow::clearStatus()
{
d->currentStatusType = 100;
statusBar()->setStyleSheet(QStringLiteral("#statusBar{}"));
// Reset to default foreground from the stylesheet/theme
statusBar()->setPalette(QPalette());
}
void MainWindow::statusMessageChanged()
@@ -2607,16 +2615,16 @@ void MainWindow::showStatus(int type, const QString& message)
QString msg = fm.elidedText(message, Qt::ElideMiddle, this->d->actionLabel->width());
switch (type) {
case MainWindow::Err:
statusBar()->setStyleSheet(d->status->err);
setStatusBarForeground(statusBar(), d->status->err);
break;
case MainWindow::Wrn:
statusBar()->setStyleSheet(d->status->wrn);
setStatusBarForeground(statusBar(), d->status->wrn);
break;
case MainWindow::Pane:
statusBar()->setStyleSheet(QStringLiteral("#statusBar{}"));
statusBar()->setPalette(QPalette());
break;
default:
statusBar()->setStyleSheet(d->status->msg);
setStatusBarForeground(statusBar(), d->status->msg);
break;
}
d->currentStatusType = -type;
@@ -2739,9 +2747,9 @@ void MainWindow::setWindowTitle(const QString& string)
StatusBarObserver::StatusBarObserver()
: WindowParameter("OutputWindow")
{
msg = QStringLiteral("#statusBar{color: #000000}"); // black
wrn = QStringLiteral("#statusBar{color: #ffaa00}"); // orange
err = QStringLiteral("#statusBar{color: #ff0000}"); // red
msg = QColor(0, 0, 0); // black
wrn = QColor(0xff, 0xaa, 0); // orange
err = QColor(0xff, 0, 0); // red
Base::Console().attachObserver(this);
getWindowParameter()->Attach(this);
getWindowParameter()->NotifyAll();
@@ -2756,24 +2764,21 @@ StatusBarObserver::~StatusBarObserver()
void StatusBarObserver::OnChange(Base::Subject<const char*>& rCaller, const char* sReason)
{
ParameterGrp& rclGrp = ((ParameterGrp&)rCaller);
auto format = QStringLiteral("#statusBar{color: %1}");
if (strcmp(sReason, "colorText") == 0) {
unsigned long col = rclGrp.GetUnsigned(sReason);
this->msg = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
this->msg = Base::Color::fromPackedRGB<QColor>(col);
}
else if (strcmp(sReason, "colorWarning") == 0) {
unsigned long col = rclGrp.GetUnsigned(sReason);
this->wrn = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
this->wrn = Base::Color::fromPackedRGB<QColor>(col);
}
else if (strcmp(sReason, "colorError") == 0) {
unsigned long col = rclGrp.GetUnsigned(sReason);
this->err = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
this->err = Base::Color::fromPackedRGB<QColor>(col);
}
else if (strcmp(sReason, "colorCritical") == 0) {
unsigned long col = rclGrp.GetUnsigned(sReason);
this->critical = format.arg(
QColor((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff).name()
);
this->critical = QColor((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff);
}
}

View File

@@ -438,7 +438,7 @@ public:
friend class MainWindow;
private:
QString msg, wrn, err, critical;
QColor msg, wrn, err, critical;
};
// -------------------------------------------------------------

View File

@@ -862,6 +862,7 @@ QListView {
QListView::item {
padding: 4px;
border-radius: 2px;
min-height: 24px;
}
QListView::item:hover {