当前位置: 首页>>代码示例>>C++>>正文


C++ QPushButton::objectName方法代码示例

本文整理汇总了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
            }
        }
    }
}
开发者ID:anandtrex,项目名称:imli-s60,代码行数:80,代码来源:keyboard.cpp

示例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();
}
开发者ID:petrpopov,项目名称:db_transactions,代码行数:31,代码来源:addcoursedialog.cpp

示例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));
	}
}
开发者ID:sun-friderick,项目名称:Miam-Player,代码行数:35,代码来源:customizethemedialog.cpp

示例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);
            }
        }
开发者ID:katik,项目名称:naali,代码行数:28,代码来源:LineEditPropertyFactory.cpp

示例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)));
}
开发者ID:anandtrex,项目名称:imli-s60,代码行数:13,代码来源:keyboard.cpp

示例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();
	}
}
开发者ID:petrpopov,项目名称:db_transactions,代码行数:26,代码来源:cataloguedialog.cpp

示例7: eventFilter

bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
	QPushButton *pBut = (QPushButton*)obj;
	QString objName = pBut->objectName();

	return QMainWindow::eventFilter(obj, event);
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:7,代码来源:MainWindow.old.cpp

示例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 );

}
开发者ID:coolixwebgraphics,项目名称:FRAMEWORK,代码行数:8,代码来源:tasarim_belge_degiskenleri_secimi.cpp

示例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 &)));
}
开发者ID:Gonaz,项目名称:Memory,代码行数:11,代码来源:mainwindow.cpp

示例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);
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:53,代码来源:MainWindow.cpp

示例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);
	};

}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:14,代码来源:MainWindow.cpp

示例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);
}
开发者ID:petrpopov,项目名称:db_transactions,代码行数:16,代码来源:prevnextbuttongroup.cpp

示例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");
        }

}
开发者ID:hoday,项目名称:JobHunter,代码行数:47,代码来源:CompanyForm.cpp

示例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);
}
开发者ID:seanmlyons22,项目名称:EEL4924C-Senior_GUI,代码行数:45,代码来源:dacdialog.cpp

示例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();
        }
    }
}
开发者ID:powder96,项目名称:Pastexen,代码行数:18,代码来源:configwidget.cpp


注:本文中的QPushButton::objectName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。