mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 10:33:24 -08:00
[QtUtils] Adopt shared Qt helpers across the client (#7618)
* [QtUtils] Add parent lookup, layout clearing, scroll area and monospace helpers * [QtUtils] Adopt shared Qt helpers across the client --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
1e0fc35d94
commit
ab13a6748f
25 changed files with 60 additions and 178 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include <QWidget>
|
||||
#include <libcockatrice/card/game_specific_terms.h>
|
||||
#include <libcockatrice/card/relation/card_relation.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qobjectdefs.h>
|
||||
|
||||
|
|
@ -33,9 +34,7 @@ CardInfoTextWidget::CardInfoTextWidget(QWidget *parent) : QFrame(parent)
|
|||
textLabel->setReadOnly(true);
|
||||
textLabel->setMinimumSize(35, 35);
|
||||
|
||||
propsScroll = new QScrollArea(this);
|
||||
propsScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
propsScroll->setWidgetResizable(true);
|
||||
propsScroll = QtUtils::makeScrollArea(this);
|
||||
propsScroll->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
propsScroll->setContentsMargins(0, 0, 0, 0);
|
||||
propsScroll->setFrameStyle(QFrame::NoFrame);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class CardSizeWidget;
|
||||
|
|
@ -179,15 +180,7 @@ void DeckCardZoneDisplayWidget::displayCards()
|
|||
void DeckCardZoneDisplayWidget::refreshDisplayType(const DisplayType &_displayType)
|
||||
{
|
||||
displayType = _displayType;
|
||||
QLayoutItem *item;
|
||||
while ((item = cardGroupLayout->takeAt(0)) != nullptr) {
|
||||
if (item->widget()) {
|
||||
item->widget()->deleteLater();
|
||||
} else if (item->layout()) {
|
||||
item->layout()->deleteLater();
|
||||
}
|
||||
delete item;
|
||||
}
|
||||
QtUtils::clearLayoutRec(cardGroupLayout);
|
||||
|
||||
indexToWidgetMap.clear();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue