本文整理汇总了C++中QCheckBox::move方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::move方法的具体用法?C++ QCheckBox::move怎么用?C++ QCheckBox::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::move方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addComponent
void CGTabPage::addComponent(QString name, QString prop, QString var, quint16 x, quint16 y, quint16 w, quint16 h) {
//RPGComponent *comp;
QLineEdit *tb;
QCheckBox *cb;
// If comp's property value is empty, then it is a checkbox, otherwise textbox.
if(prop.isEmpty()) {
//comp = new RGCheckBox(panel, page(), QPoint(x, y), QPoint(w, h));
cb = new QCheckBox(this);
cb->move(x, y);
cb->resize(w, h);
} else {
//comp = new RGTextBox(panel, page(), QPoint(x, y), QPoint(w, h));
tb = new QLineEdit(this);
tb->move(x, y);
tb->resize(w, h);
// Add Text to TextBox
//RGTextBox *tb = (RGTextBox *)comp;
if(var.isEmpty()) // Is it a character trait?
tb->setText(name + ":" + prop);
else
tb->setText(name + ":" + var + ":" + prop);
tb->show();
}
/* comp->setDataName(name);
comp->setDataProperty(prop);
comp->setDataVariable(var);
components.append(comp);
RPGRulebook::Instance()->addComponent(comp); */
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget window;
QLabel *label = new QLabel(QApplication::translate("windowlayout", "Scale:"),&window);
QCheckBox *chb = new QCheckBox(QApplication::translate("windowlayout", "Calc mode"),&window);
mle *myline = new mle(&window);
render widget(&window);
QPainter painter;
QSlider *spinbox = new QSlider(Qt::Horizontal,&window);
spinbox->setValue(30);
widget.setGeometry(10,10, 512, 512);
myline->setGeometry(10,532,512,20);
myline->setText("Enter expession");
myline->createStandardContextMenu();
myline->selectAll();
label->setGeometry(532,10,200,20);
chb->move(532,535);
spinbox->setGeometry(567,10,165,20);
spinbox->setRange(1, 200);
//Святое место определения механизма сигналов и слотов, унёсший 8 дней практики на реализацию передачи значений между экземплярами класса
//изменять с осторожностью и благословлением, церковная зона
QObject::connect(spinbox, SIGNAL(valueChanged(int)), &widget, SLOT(scale(int)));
QObject::connect(spinbox, SIGNAL(valueChanged(int)), myline, SLOT(emitsig()));
QObject::connect(myline, SIGNAL(returnPressed()), myline, SLOT(emitsig()));
QObject::connect(myline, SIGNAL(givechar(QString)), &widget, SLOT(calc(QString)));
QObject::connect(chb, SIGNAL(stateChanged(int)), &widget, SLOT(chk(int)));
QObject::connect(&widget, SIGNAL(emitstr(QString)), myline, SLOT(takestr(QString)));
//конец защищенной церковной зоны
window.setWindowTitle(
QApplication::translate("GCPLOT", "GCPLOT"));
window.setFixedSize(742, 562);
window.show();
return app.exec();
}
示例3: QCheckBox
WidgetParameterBool::WidgetParameterBool(ParameterPtrT<bool> parameter)
: WidgetParameter<bool>(parameter)
{
QCheckBox* checkBox = new QCheckBox(this);
checkBox->setChecked(parameter->lastValue());
checkBox->move(0,0);
parameter->addNewInternalValueCallback([checkBox, this](bool value){
checkBox->blockSignals(true);
checkBox->setChecked(value);
checkBox->blockSignals(false);
});
BOOST_VERIFY(connect(checkBox, SELECT<bool>::OVERLOAD_OF(&QCheckBox::clicked), [this](bool b) {
mParameter->set(b);
}));
mWidget = checkBox;
}
示例4: onClick
/*
class QSlotStorage : public QObject {
public:
QSlotStorage() { }
void onClick() {
printf("QSlotStorage::onClicked()\n");
fflush(stdout);
}
};
*/
int main() {
BApplication *app = new BApplication("application/x.vnd-Lemon-Nirvana");
TestWindow *test = new TestWindow( BRect(30,30,700,500), "test1" );
QWidget *widget = test->RootWidget();
QCheckBox *check = new QCheckBox( widget );
check->resize(100,200);
QSlotStorage *storage = new QSlotStorage();
QObject::connect(check, SIGNAL(clicked()), new QSlot(storage, SLOT(onClick())));
KWQSignal *signal = check->findSignal(SIGNAL(clicked()));
//printf("%s\n",signal->_name);
signal->call();
check->setText("Label sd fsd fsd fsd fsd fsd fsd fsd fsd fsd fsd fsd fs dfs df sd fsd fs fd");
check->move(100,100);
test->Show();
app->Run();
return 0;
}
示例5: ConfigWindowBase
CupcakeWar::CupcakeWar(QWidget* parent)
: ConfigWindowBase(parent),
nutritions({"Grape", "Kiwi", "Orange", "Pineapple", "Raspberry", "Straberry"}),
other_attr_val(4, 0)
{
add_level();
for (int i = 0; i < (int)nutritions.size(); ++i) {
QCheckBox* qcb = new QCheckBox(nutritions[i], this);
QLineEdit* txt = new QLineEdit(this);
qcb->move(400, 100 + i * 40);
txt->move(500, 100 + i * 40);
selection.push_back(std::make_pair(qcb, txt));
txt->setValidator(validator);
connect(qcb, SIGNAL(clicked()), this, SLOT(SetVal()));
connect(qcb, SIGNAL(clicked()), this, SLOT(CheckEmpty()));
connect(txt, SIGNAL(editingFinished()), this, SLOT(SetVal()));
connect(txt, SIGNAL(textEdited(QString)), this, SLOT(CheckEmpty()));
}
for(int i = 0; i < 4; ++i) {
QLineEdit* txt = new QLineEdit(this);
txt->move(200, 100 + i * 40);
QLabel *name = new QLabel(i == 0 ? "flour amount"
: i == 1 ? "milk amount"
: i == 2 ? "max"
: "min", this);
name->move(100, 100 + i * 40);
other_attr.push_back(txt);
connect(txt, SIGNAL(editingFinished()), this, SLOT(SetVal()));
}
grade = new QComboBox(this);
QLabel *name = new QLabel("grade", this);
name->move(100, 100 + 4 * 40);
grade->move(200, 100 + 4 * 40);
grade->addItems({"3", "4", "5", "6", "7", "8"});
// connect(list_view, SIGNAL(level_added()), this, SLOT(add_level()));
// connect(list_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(Update(QModelIndex)));
}
示例6: updateItemWidgets
void ServiceItemDelegate::updateItemWidgets(const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
const QPersistentModelIndex& index) const
{
QCheckBox* checkBox = static_cast<QCheckBox*>(widgets[0]);
KPushButton *configureButton = static_cast<KPushButton*>(widgets[1]);
const int itemHeight = sizeHint(option, index).height();
// Update the checkbox showing the service name and icon
const QAbstractItemModel* model = index.model();
checkBox->setText(model->data(index).toString());
const QString iconName = model->data(index, Qt::DecorationRole).toString();
if (!iconName.isEmpty()) {
checkBox->setIcon(KIcon(iconName));
}
checkBox->setChecked(model->data(index, Qt::CheckStateRole).toBool());
const bool configurable = model->data(index, ServiceModel::ConfigurableRole).toBool();
int checkBoxWidth = option.rect.width();
if (configurable) {
checkBoxWidth -= configureButton->sizeHint().width();
}
checkBox->resize(checkBoxWidth, checkBox->sizeHint().height());
checkBox->move(0, (itemHeight - checkBox->height()) / 2);
// Update the configuration button
if (configurable) {
configureButton->setEnabled(checkBox->isChecked());
configureButton->setIcon(KIcon("configure"));
configureButton->resize(configureButton->sizeHint());
configureButton->move(option.rect.right() - configureButton->width(),
(itemHeight - configureButton->height()) / 2);
}
configureButton->setVisible(configurable);
}
示例7: updateItemWidgets
void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
{
// draws:
// AccountName
// Checkbox | Icon | | ConnectionIcon | ConnectionState
// errorMessage
if (!index.isValid()) {
return;
}
Q_ASSERT(widgets.size() == 6);
// Get the widgets
QCheckBox* checkbox = qobject_cast<QCheckBox*>(widgets.at(0));
ChangeIconButton* changeIconButton = qobject_cast<ChangeIconButton*>(widgets.at(1));
QLabel *statusTextLabel = qobject_cast<QLabel*>(widgets.at(2));
QLabel *statusIconLabel = qobject_cast<QLabel*>(widgets.at(3));
EditDisplayNameButton *displayNameButton = qobject_cast<EditDisplayNameButton*>(widgets.at(4));
QLabel *connectionErrorLabel = qobject_cast<QLabel*>(widgets.at(5));
Q_ASSERT(checkbox);
Q_ASSERT(changeIconButton);
Q_ASSERT(statusTextLabel);
Q_ASSERT(statusIconLabel);
Q_ASSERT(displayNameButton);
Q_ASSERT(connectionErrorLabel);
bool isSelected(itemView()->selectionModel()->isSelected(index) && itemView()->hasFocus());
bool isEnabled(index.data(KTp::AccountsListModel::EnabledRole).toBool());
KIcon accountIcon(index.data(Qt::DecorationRole).value<QIcon>());
KIcon statusIcon(index.data(KTp::AccountsListModel::ConnectionStateIconRole).value<QIcon>());
QString statusText(index.data(KTp::AccountsListModel::ConnectionStateDisplayRole).toString());
QString displayName(index.data(Qt::DisplayRole).toString());
QString connectionError(index.data(KTp::AccountsListModel::ConnectionErrorMessageDisplayRole).toString());
Tp::AccountPtr account(index.data(KTp::AccountsListModel::AccountRole).value<Tp::AccountPtr>());
if (!account->isEnabled()) {
connectionError = i18n("Click checkbox to enable");
}
QRect outerRect(0, 0, option.rect.width(), option.rect.height());
QRect contentRect = outerRect.adjusted(m_hpadding,m_vpadding,-m_hpadding,-m_vpadding); //add some padding
// checkbox
if (isEnabled) {
checkbox->setChecked(true);;
checkbox->setToolTip(i18n("Disable account"));
} else {
checkbox->setChecked(false);
checkbox->setToolTip(i18n("Enable account"));
}
int checkboxLeftMargin = contentRect.left();
int checkboxTopMargin = (outerRect.height() - checkbox->height()) / 2;
checkbox->move(checkboxLeftMargin, checkboxTopMargin);
// changeIconButton
changeIconButton->setIcon(accountIcon);
changeIconButton->setAccount(account);
// At the moment (KDE 4.8.1) decorationSize is not passed from KWidgetItemDelegate
// through the QStyleOptionViewItem, therefore we leave default size unless
// the user has a more recent version.
if (option.decorationSize.width() > -1) {
changeIconButton->setButtonIconSize(option.decorationSize.width());
}
int changeIconButtonLeftMargin = checkboxLeftMargin + checkbox->width();
int changeIconButtonTopMargin = (outerRect.height() - changeIconButton->height()) / 2;
changeIconButton->move(changeIconButtonLeftMargin, changeIconButtonTopMargin);
// statusTextLabel
QFont statusTextFont = option.font;
QPalette statusTextLabelPalette = option.palette;
if (isEnabled) {
statusTextLabel->setEnabled(true);
statusTextFont.setItalic(false);
} else {
statusTextLabel->setDisabled(true);
statusTextFont.setItalic(true);
}
if (isSelected) {
statusTextLabelPalette.setColor(QPalette::Text, statusTextLabelPalette.color(QPalette::Active, QPalette::HighlightedText));
}
statusTextLabel->setPalette(statusTextLabelPalette);
statusTextLabel->setFont(statusTextFont);
statusTextLabel->setText(statusText);
statusTextLabel->setFixedSize(statusTextLabel->fontMetrics().boundingRect(statusText).width(),
statusTextLabel->height());
int statusTextLabelLeftMargin = contentRect.right() - statusTextLabel->width();
int statusTextLabelTopMargin = (outerRect.height() - statusTextLabel->height()) / 2;
statusTextLabel->move(statusTextLabelLeftMargin, statusTextLabelTopMargin);
// statusIconLabel
statusIconLabel->setPixmap(statusIcon.pixmap(KIconLoader::SizeSmall));
//.........这里部分代码省略.........
示例8: Pal
Piano::Piano(QWidget *parent) :
QWidget(parent)
{
init_log();
QPalette Pal(palette());
Pal.setColor(QPalette::Background, QColor::fromRgb(240, 240, 240));
setAutoFillBackground(true);
setPalette(Pal);
showing = false; //displaying the scorebox
b_names_dip = false;
b_racc_disp = false;
notes = new QVector<Touche*>();
notes_jouees = new QVector<QString>();
setFixedSize(800, 310);
QPushButton *raccButt= new QPushButton(QString(""),this);
raccButt->setToolTip(QString("Affiche les raccourcis clavier pour le piano"));
QPushButton *noteNames = new QPushButton(QString(""),this);
noteNames->setToolTip(QString("Affiche le nom des notes sur le piano"));
QCheckBox *checkB = new QCheckBox(QString("options affichage"),this);
checkB->setToolTip(QString("Affiche/cache les options d'affiche du piano"));
QPushButton *retour = new QPushButton(QString(""),this);
checkB->setChecked(true);
retour->move(740,0);
retour->setStyleSheet("border-image: url(:/new/prefix1/undo.png)");
retour->setToolTip(QString("Annule la dernière note jouée"));
retour->resize(50,50);
QPushButton *solution = new QPushButton(QString("Solution"),this);
solution->setToolTip(QString("Aide: Indique la note suivante sur le piano"));
solution->move(0,10);
checkB->move(0,282);
Touche* doM = new Touche(this, QString("tab"),QString("Do"));
int sizeT= 38;//doM->width();
//QMessageBox::information(new QWidget(),QString("taille "),QString::number(sizeT));
int hauteur = 100;
int nT =3;
raccButt->move(0,hauteur+50);
raccButt->setFixedSize(140,50);
raccButt->setStyleSheet("border-image: url(:/img/clavier.svg.png);"
);
noteNames->move(660,hauteur +50);
noteNames->setFixedSize(140,50);
noteNames->setStyleSheet("border-image: url(:/img/doremi);"
"border-width: 2px;");
doM->move(sizeT*nT,hauteur);
nT+=1;
Touche* reM = new Touche(this, QString("A"),QString("Ré"));
reM->move(sizeT*nT,hauteur);
nT+=1;
Touche* miM = new Touche(this, QString("Z"),QString("Mi"));
miM->move(sizeT*nT,hauteur);
nT+=1;
Touche* faM = new Touche(this, QString("E"),QString("Fa"));
faM->move(sizeT*nT,hauteur);
nT+=1;
Touche* solM = new Touche(this, QString("R"),QString("Sol"));
solM->move(sizeT*nT,hauteur);
nT+=1;
Touche* laM = new Touche(this, QString("T"),QString("La"));
laM->move(sizeT*nT,hauteur);
nT+=1;
Touche* siM = new Touche(this, QString("Y"),QString("si"));
siM->move(sizeT*nT,hauteur);
nT+=1;
Touche* dom = new Touche(this, QString("U"),QString("Do"));
dom->move(sizeT*nT,hauteur);
nT+=1;
Touche* rem = new Touche(this, QString("I"),QString("Ré"));
rem->move(sizeT*nT,hauteur);
nT+=1;
Touche* mim = new Touche(this, QString("O"),QString("Mi"));
mim->move(sizeT*nT,hauteur);
nT+=1;
Touche* fam = new Touche(this, QString("P"),QString("Fa"));
fam->move(sizeT*nT,hauteur);
nT+=1;
Touche* solm = new Touche(this, QString(/*"dead_circumflex"*/"16781906"),QString("Sol"));
solm->move(sizeT*nT,hauteur);
nT+=1;
Touche* lam = new Touche(this, QString("$"),QString("La"));
lam->move(sizeT*nT,hauteur);
nT+=1;
Touche* sim = new Touche(this, QString("Return"),QString("si"));
sim->move(sizeT*nT,hauteur);
nT=4;
Touche* doMD = new Touche(this, QString("&"),QString("Do#"));
doMD->black();
//.........这里部分代码省略.........