mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
style: Add braces to all control flow statements (#6887)
* style: Add braces to all control flow statements Standardize code style by adding explicit braces to all single-statement control flow blocks (if, else, for, while) across the entire codebase. Also documents the InsertBraces clang-format option (requires v15+) for future automated enforcement. * InsertBraces-check-enabled
This commit is contained in:
parent
7153f7d4c1
commit
aadee34238
173 changed files with 2725 additions and 1461 deletions
|
|
@ -252,8 +252,9 @@ void ZoneViewWidget::retranslateUi()
|
|||
|
||||
void ZoneViewWidget::stopWindowDrag()
|
||||
{
|
||||
if (!draggingWindow)
|
||||
if (!draggingWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
draggingWindow = false;
|
||||
ungrabMouse();
|
||||
|
|
@ -312,13 +313,15 @@ QGraphicsView *ZoneViewWidget::findDragView(QWidget *eventWidget) const
|
|||
{
|
||||
QWidget *current = eventWidget;
|
||||
while (current) {
|
||||
if (auto *view = qobject_cast<QGraphicsView *>(current))
|
||||
if (auto *view = qobject_cast<QGraphicsView *>(current)) {
|
||||
return view;
|
||||
}
|
||||
current = current->parentWidget();
|
||||
}
|
||||
|
||||
if (scene() && !scene()->views().isEmpty())
|
||||
if (scene() && !scene()->views().isEmpty()) {
|
||||
return scene()->views().constFirst();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -346,8 +349,9 @@ bool ZoneViewWidget::windowFrameEvent(QEvent *event)
|
|||
}
|
||||
|
||||
auto *me = dynamic_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
if (!me)
|
||||
if (!me) {
|
||||
return QGraphicsWidget::windowFrameEvent(event);
|
||||
}
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::GraphicsSceneMousePress:
|
||||
|
|
@ -506,8 +510,9 @@ void ZoneViewWidget::resizeToZoneContents(bool forceInitialHeight)
|
|||
|
||||
zone->setGeometry(QRectF(0, -scrollBar->value(), zoneContainer->size().width(), totalZoneHeight));
|
||||
|
||||
if (layout())
|
||||
if (layout()) {
|
||||
layout()->invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneViewWidget::handleScrollBarChange(int value)
|
||||
|
|
@ -521,8 +526,9 @@ void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
|||
disconnect(zone, &ZoneViewZone::closed, this, 0);
|
||||
// manually call zone->close in order to remove it from the origZones views
|
||||
zone->close();
|
||||
if (shuffleCheckBox.isChecked())
|
||||
if (shuffleCheckBox.isChecked()) {
|
||||
player->getPlayerActions()->sendGameCommand(Command_Shuffle());
|
||||
}
|
||||
zoneDeleted();
|
||||
event->accept();
|
||||
}
|
||||
|
|
@ -536,8 +542,9 @@ void ZoneViewWidget::zoneDeleted()
|
|||
void ZoneViewWidget::initStyleOption(QStyleOption *option) const
|
||||
{
|
||||
QStyleOptionTitleBar *titleBar = qstyleoption_cast<QStyleOptionTitleBar *>(option);
|
||||
if (titleBar)
|
||||
if (titleBar) {
|
||||
titleBar->icon = QPixmap("theme:cockatrice");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue