本文整理汇总了C++中QPushButton::objectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::objectName方法的具体用法?C++ QPushButton::objectName怎么用?C++ QPushButton::objectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::objectName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void VirtualKeyboard::Update()
{
//TODO font set here
imli_script_t script = imli_get_active_script(context_);
if (script == SCRIPT_UNSUPPORTED)
return;
QFont font = styles_[script].font();
//font.setPointSize((script == SCRIPT_ASCII) ? 12 : 14);
font.setPointSize(8);
const QObjectList& objects = this->verticalLayoutWidget->children();
int index = (shifted_ ? 1 : 0);
for (int i = 0; i < objects.size(); i++)
{
QPushButton* child = dynamic_cast<QPushButton*>(objects.at(i));
if (child)
{
child->setEnabled(true);
QString name = getObjectName(child->objectName());
if (name.length() > 2){
continue;
}
child->setFont(font);
char key = name.toAscii()[index];
if (script != SCRIPT_ASCII)
{
syl_t syl = SYL_INVALID;
int del;
syl = imli_process_key(context_,
key,
SCRIPT_UNSUPPORTED,
SYL_INVALID,
FLAG_NONE,
&del);
if (syl != SYL_INVALID)
{
QByteArray glyphs;
glyphs.reserve(32);
size_t len = 0;
imli_status_t status = syl_to_glyphs(context_,
syl,
script,
(byte_t*)glyphs.data(),
glyphs.capacity(),
&len);
if (status == IMLI_STATUS_OK)
{
glyphs.resize(len);
child->setText(QString::fromAscii(glyphs, glyphs.size()));
}
else
{
child->setText("");
}
}
else
{
child->setText("");
}
}
else
{
QString label(key);
if (key == '&')
label.append('&');
child->setText(label);
}
if(child->text().operator ==("")){
child->setDisabled(true); //Disable empty buttons
}
}
}
}
示例2: selectItem
void AddCourseDialog::selectItem()
{
QPushButton *button = qobject_cast<QPushButton *>( sender() );
if( !button )
return;
int row = listWidget->currentRow();
if( button->objectName() == "upButton" )
{
if( --row <= 0 )
row = 0;
}
else if( button->objectName() == "downButton" )
{
if( ++row >= listWidget->count() )
{
row = listWidget->count() - 1;
if( row <= 0 )
row = 0;
}
}
QListWidgetItem *item = listWidget->item(row);
if( !item )
return;
listWidget->setCurrentItem( item );
item->setSelected( true );
listWidget->setFocus();
}
示例3: openChooseIconDialog
void CustomizeThemeDialog::openChooseIconDialog()
{
QPushButton *button = qobject_cast<QPushButton *>(sender());
SettingsPrivate *settings = SettingsPrivate::instance();
// It's always more convenient when the dialog re-open at the same location
QString openPath;
QVariant variantOpenPath = settings->value("customIcons/lastOpenPath");
if (variantOpenPath.isValid()) {
openPath = variantOpenPath.toString();
} else {
openPath = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first();
}
QString path = QFileDialog::getOpenFileName(this, tr("Choose your custom icon"), openPath, tr("Pictures (*.jpg *.jpeg *.png)"));
// Reset custom icon if path is empty (delete key in settings too)
settings->setCustomIcon(button->objectName() + "Button", path);
for (MediaButton *b : _mainWindow->findChildren<MediaButton*>(button->objectName() + "Button")) {
if (b) {
b->setIcon(QIcon(path));
}
}
MediaButton *b = _mainWindow->findChild<MediaButton*>(button->objectName() + "Button");
if (path.isEmpty()) {
button->setIcon(QIcon(":/player/" + Settings::instance()->theme() + "/" + button->objectName()));
b->setIcon(QIcon());
} else {
settings->setValue("customIcons/lastOpenPath", QFileInfo(path).absolutePath());
button->setIcon(QIcon(path));
b->setIcon(QIcon(path));
}
}
示例4: OnButtonClicked
void LineEditPropertyFactory::OnButtonClicked()
{
QPushButton *button = qobject_cast<QPushButton*>(sender());
if (!button)
return;
QString function;
for(uint i = 0; i < (uint)buttons_.size(); ++i)
{
if (buttons_[i].objectName == button->objectName())
{
function = buttons_[i].method;
break;
}
}
if(!function.isNull())
{
foreach(const ComponentWeakPtr &comp_ptr, components_)
{
ComponentPtr comp = comp_ptr.lock();
if (comp)
{
QVariantList list;
list.push_back(QVariant(button->objectName()));
FunctionInvoker::Invoke(comp.get(), function, list);
}
}
示例5: SetupConnections
void VirtualKeyboard::SetupConnections()
{
const QObjectList& objects = this->verticalLayoutWidget->children();
for (int i = 0; i < objects.size(); i++)
{
QPushButton* button = qobject_cast<QPushButton*>(objects.at(i));
if (button && button->objectName() != "caps" && button->objectName() != "shift")
{
connect(button, SIGNAL(clicked()), this, SLOT(Clicked()));
}
}
connect(this->shift, SIGNAL(toggled(bool)), this, SLOT(setShifted(bool)));
}
示例6: okButtonClicked
void CatalogueDialog::okButtonClicked()
{
bool close = false;
QPushButton *button = qobject_cast<QPushButton *>( sender() );
if( !button )
close = false;
else
{
if( button->objectName() == "showCloseButton" )
close = true;
}
QTreeWidgetItem *item = treeWidget->currentItem();
if( !item )
return;
int count = item->childCount();
if( count == 0 )
{
QString str = item->text(0);
emit pageRequested(str);
if( close )
accept();
}
}
示例7: eventFilter
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
QPushButton *pBut = (QPushButton*)obj;
QString objName = pBut->objectName();
return QMainWindow::eventFilter(obj, event);
}
示例8: SLOT_DEGISKEN_KULLAN
void TASARIM_BELGE_DEGISKENLERI_SECIMI::SLOT_DEGISKEN_KULLAN()
{
QPushButton *button = static_cast<QPushButton*>(sender());
m_degisken_listesi.at( button->objectName().split("\t").at(0).toInt())->SET_VISIBLE( true );
button->setEnabled( false );
}
示例9: makeSignalMapper
void MainWindow::makeSignalMapper() {
signalMapper = new QSignalMapper(this);
for (int i=0; i < buttons->size(); ++i) {
QPushButton *button = buttons->at(i);
connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(button, button->objectName());
}
connect(signalMapper, SIGNAL(mapped(const QString &)), this, SLOT(cardClicked(const QString &)));
}
示例10: eventFilter
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
QPushButton *pBut = (QPushButton*)obj;
QString objName = pBut->objectName();
int index = 0;
if ( objName.compare("pushButton_0") == 0 ) index = DISPLAYTYPE;
else if( objName.compare("pushButton_1") == 0 ) index = DISPLAYTYPE1;
else if( objName.compare("pushButton_2") == 0 ) index = DISPLAYTYPE2;
else if( objName.compare("pushButton_3") == 0 ) index = DISPLAYTYPE3;
else if( objName.compare("pushButton_4") == 0 ) index = DISPLAYTYPE4;
else if( objName.compare("pushButton_5") == 0 ) index = DISPLAYTYPE5;
else if( objName.compare("pushButton_6") == 0 ) index = DISPLAYTYPE6;
else if( objName.compare("pushButton_7") == 0 ) index = DISPLAYTYPE7;
else if( objName.compare("pushButton_8") == 0 ) index = DISPLAYTYPE8;
else if( objName.compare("pushButton_9") == 0 ) index = DISPLAYTYPE9;
else if( objName.compare("pushButton_10") == 0 ) index = DISPLAYTYPE10;
else if( objName.compare("pushButton_11") == 0 ) index = DISPLAYTYPE11;
else if( objName.compare("pushButton_12") == 0 ) index = DISPLAYTYPE12;
else if( objName.compare("pushButton_13") == 0 ) index = DISPLAYTYPE13;
else if( objName.compare("pushButton_14") == 0 ) index = DISPLAYTYPE14;
else if( objName.compare("pushButton_15") == 0 ) index = DISPLAYTYPE15;
else if( objName.compare("pushButton_16") == 0 ) index = DISPLAYTYPE16;
else if( objName.compare("pushButton_17") == 0 ) index = DISPLAYTYPE17;
else index = -1;
QString passwd = passWord.at(index);
if(event->type()==QEvent::MouseButtonPress && pBut -> isEnabled() && (index < DISPLAYTOT || index >= DISPLAYTYPE))
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->buttons() & Qt::LeftButton)
{
if(passwd.compare("") != 0)
{
//qDebug("Password: %s", passwd.toStdString().c_str());
#if 0
Password pword(passwd, new QWidget());
if(pword.getStatus()== true) displayDockWidget(index, pBut);
#endif
#if 1
displayDockWidget(index, pBut);
#endif
}
else
{
displayDockWidget(index, pBut);
}
return true;
}
return false;
}
return QMainWindow::eventFilter(obj, event);
}
示例11: setEnableButtons
void MainWindow::setEnableButtons(QPushButton *pobj)
{
QList<QPushButton *> allPButtons = findChildren<QPushButton *>();
QString objName;
for (int i = 0; i < allPButtons.size(); ++i)
{
QPushButton *pushbutton = (QPushButton*)allPButtons.at(i);
objName = pushbutton->objectName();
if ( objName.compare(pobj->objectName()) == 0 ) pushbutton -> setEnabled(false);
else pushbutton -> setEnabled(true);
};
}
示例12: buttonClick
void PrevNextButtonGroup::buttonClick()
{
QPushButton *button = static_cast<QPushButton *>( sender() );
if( !button )
return;
QString name = button->objectName();
if( name == "firstButton" )
emit buttonClicked(0);
else if( name == "prevButton" )
emit buttonClicked(1);
else if( name == "nextButton" )
emit buttonClicked(2);
else if( name == "lastButton" )
emit buttonClicked(3);
}
示例13: removeButton_clicked
void CompanyForm::removeButton_clicked()
{
try
{
QPushButton* button = qobject_cast<QPushButton*>(this->sender());
if (button)
{
this->ShowCompanyDetails(button->objectName().toStdString());
QMessageBox messageBox;
messageBox.setText("Are you sure you want to delete this company?");
messageBox.setInformativeText("This company and all applications and contacts associated with it will be deleted. Are you sure?");
messageBox.setStandardButtons(QMessageBox::No|QMessageBox::Yes);
messageBox.setIcon(QMessageBox::Question);
if (messageBox.exec() == QMessageBox::Yes)
{
this->database->DeleteCompany(this->selectedCompany->ID);
this->LoadCompanySummaries();
}
}
}
catch(WarningException& e)
{
this->DisplayProblem(e.problem);
Logger::GetInstance().Warn(e);
}
catch(FatalException& e)
{
this->DisplayProblem(e.problem);
Logger::GetInstance().Fatal(e);
}
catch(...)
{
QMessageBox messageBox;
messageBox.setText("Unhandled exception");
messageBox.setInformativeText("CompanyForm::removeButton_clicked Unhandled exception");
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.setIcon(QMessageBox::Critical);
Logger::GetInstance().Fatal("CompanyForm::removeButton_clicked Unhandled exception");
}
}
示例14: sendDACMessage
void dacDialog::sendDACMessage()
{
QObject *callerPB = QObject::sender();
QPushButton *caller = qobject_cast<QPushButton *>(callerPB);
bool readNotWrite;
if("readPushButton" == caller->objectName())
readNotWrite = true;
else
readNotWrite = false;
SET_GROUP(activeMsg->header, DAC_MSG);
readNotWrite ? activeMsg->header |= 0x01 : activeMsg->header &= 0xFE;
EN_GROUP(activeMsg->header);
activeMsg->size = GUI_MSG_SIZE;
QString pageString = ui->pageLineEdit->text();
pageString.remove("0x", Qt::CaseSensitive);
QString addressString = ui->addressLineEdit->text();
addressString.remove("0x", Qt::CaseSensitive);
QString dataString = ui->dataLineEdit->text();
dataString.remove("0x", Qt::CaseSensitive);
bool ok;
unsigned short page = pageString.toShort(&ok, 16);
if(!ok)
return;
unsigned short address = addressString.toShort(&ok, 16);
if(!ok)
return;
unsigned short data;
if(!readNotWrite)
{
data = dataString.toShort(&ok, 16);
if(!ok)
return;
}
else
data = 0;
activeMsg->data[0] = page;
activeMsg->data[1] = address;
activeMsg->data[2] = data;
for(int i = 3; i < GUI_MSG_SIZE - 2; ++i)
activeMsg->data[i] = 0;
writeGUIMessage(activeMsg);
}
示例15: changeHotkey
void ConfigWidget::changeHotkey()
{
ScanHotkeyDialog dial(this);
dial.setModal(true);
if (dial.exec()) {
QPushButton* b = qobject_cast<QPushButton*>(sender());
if (b) {
QString settingsKey("general/");
settingsKey += b->objectName();
_settings->setValue(settingsKey, dial.key());
b->setText(dial.key());
registerActualHotkeys();
}
}
}