mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Updated reveal zone check boxes
I saw in some images from other platforms it can take up alot of space. Made the boxed horizontal, rather than vertical. WIP Remade reveal zone + darkened card area to eaisily see boundries + reverted back to using a window + window can be resized + removed fake title bar and "X" + moved all cards revealed slightly to the right, makes it easier to drag-select from the left Cleanup Changed style to use cockatrice icon Changed cast from static_cast to qstyleoption_cast
This commit is contained in:
parent
cf24f4aa04
commit
1e0c4cbf87
3 changed files with 20 additions and 26 deletions
|
|
@ -7,6 +7,8 @@
|
|||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QScrollBar>
|
||||
#include <QStyleOption>
|
||||
#include <QStyleOptionTitleBar>
|
||||
#include "zoneviewwidget.h"
|
||||
#include "carditem.h"
|
||||
#include "zoneviewzone.h"
|
||||
|
|
@ -57,28 +59,14 @@ void TitleLabel::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
}
|
||||
|
||||
ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberCards, bool _revealZone, bool _writeableRevealZone, const QList<const ServerInfo_Card *> &cardList)
|
||||
: QGraphicsWidget(0, Qt::Tool | Qt::FramelessWindowHint), canBeShuffled(_origZone->getIsShufflable()), player(_player)
|
||||
: QGraphicsWidget(0, Qt::Window), canBeShuffled(_origZone->getIsShufflable()), player(_player)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setZValue(2000000006);
|
||||
setFlag(ItemIgnoresTransformations);
|
||||
|
||||
QGraphicsLinearLayout *hbox = new QGraphicsLinearLayout(Qt::Horizontal);
|
||||
titleLabel = new TitleLabel;
|
||||
connect(titleLabel, SIGNAL(mouseMoved(QPointF)), this, SLOT(moveWidget(QPointF)));
|
||||
closeButton = new QPushButton("X");
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
QGraphicsProxyWidget *closeButtonProxy = new QGraphicsProxyWidget;
|
||||
closeButtonProxy->setWidget(closeButton);
|
||||
|
||||
hbox->addItem(titleLabel);
|
||||
hbox->addItem(closeButtonProxy);
|
||||
QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
|
||||
|
||||
vbox->addItem(hbox);
|
||||
|
||||
QGraphicsLinearLayout *hPilebox = 0;
|
||||
|
||||
if (numberCards < 0) {
|
||||
|
|
@ -179,19 +167,13 @@ void ZoneViewWidget::processSetPileView(int value) {
|
|||
|
||||
void ZoneViewWidget::retranslateUi()
|
||||
{
|
||||
titleLabel->setText(zone->getTranslatedName(false, CaseNominative));
|
||||
setWindowTitle(zone->getTranslatedName(false, CaseNominative));
|
||||
sortByNameCheckBox.setText(tr("sort by name"));
|
||||
sortByTypeCheckBox.setText(tr("sort by type"));
|
||||
shuffleCheckBox.setText(tr("shuffle when closing"));
|
||||
pileViewCheckBox.setText(tr("pile view"));
|
||||
}
|
||||
|
||||
void ZoneViewWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
painter->fillRect(boundingRect(), palette().color(QPalette::Window));
|
||||
QGraphicsWidget::paint(painter, option, widget);
|
||||
}
|
||||
|
||||
void ZoneViewWidget::moveWidget(QPointF scenePos)
|
||||
{
|
||||
if(scenePos.x() < 0)
|
||||
|
|
@ -264,3 +246,9 @@ void ZoneViewWidget::zoneDeleted()
|
|||
emit closePressed(this);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void ZoneViewWidget::initStyleOption(QStyleOption *option) const {
|
||||
QStyleOptionTitleBar *titleBar = qstyleoption_cast<QStyleOptionTitleBar *>(option);
|
||||
if (titleBar)
|
||||
titleBar->icon = QIcon(":/resources/appicon.svg");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue