BCESolve
bcelineedit.hpp
1// This file is part of the BCESolve library for games of incomplete
2// information
3// Copyright (C) 2022 Benjamin A. Brooks
4//
5// BCESolve free software: you can redistribute it and/or modify it
6// under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// BCESolve is distributed in the hope that it will be useful, but
11// WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see
17// <http://www.gnu.org/licenses/>.
18//
19// Benjamin A. Brooks
20// ben@benjaminbrooks.net
21// Chicago, IL
22
23#ifndef BCELINEEDIT_HPP
24#define BCELINEEDIT_HPP
25
26#include <QtWidgets>
27#include "bceenumeration.hpp"
28
30
36class BCELineEdit : public QLineEdit
37{
38 Q_OBJECT;
39
40public:
41
43 BCESliderType sliderType;
45 int player;
46
48 BCELineEdit(BCESliderType _type, int _player):
49 sliderType(_type),player(_player),QLineEdit()
50 {}
51
52public slots:
53
55
58 void changeDisplayValue(int newValEmitted,
59 BCESliderType typeEmitted,
60 int playerEmitted) {
61 if (sliderType == typeEmitted && player == playerEmitted)
62 setText(QString::number(newValEmitted));
63 }
64
65};
66
67#endif
Read-only QLineEdits displaying slider values.
Definition: bcelineedit.hpp:37
BCESliderType sliderType
Type of BCELineEdit (Action, Type, State)
Definition: bcelineedit.hpp:38
BCELineEdit(BCESliderType _type, int _player)
Constructor.
Definition: bcelineedit.hpp:48
int player
Player associated with the BCELineEdit.
Definition: bcelineedit.hpp:45
void changeDisplayValue(int newValEmitted, BCESliderType typeEmitted, int playerEmitted)
Ensures slider is set to the changed value.
Definition: bcelineedit.hpp:58