Example #1
0
File: main.cpp Project: maxxant/qt
//! [0]
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
	QString path = MceVibrator::defaultMceFilePath;

    QFile file(path);
    QStringList names;
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream stream(&file);
        names = MceVibrator::parsePatternNames(stream);
        file.close();
    }

    if (names.isEmpty()){
        qDebug() << "Could not read vibration pattern names from " << path;
        a.exit(-1);
    }
//! [0]

//! [1]
    ButtonWidget buttonWidget(names);
    MceVibrator vibrator;
    QObject::connect(&buttonWidget, SIGNAL(clicked(const QString &)),
                     &vibrator, SLOT(vibrate(const QString &)));
    buttonWidget.show();

    return a.exec();
}
void GroupIndicatorOverlay::setActive(bool active)
{
    AbstractWidgetDelegateOverlay::setActive(active);

    if (active)
    {
        connect(buttonWidget(), SIGNAL(clicked()),
                this, SLOT(slotButtonClicked()));

        connect(buttonWidget(), SIGNAL(contextMenu(QContextMenuEvent*)),
                this, SLOT(slotButtonContextMenu(QContextMenuEvent*)));
    }
    else
    {
        // widget is deleted
    }
}
void MColorComboBoxViewPrivate::init()
{
    layout = new MLayout();
    layout->setContentsMargins(0, 0, 0, 0);
    controller->setLayout(layout);

    policy = new MGridLayoutPolicy(layout);
    policy->setContentsMargins(0, 0, 0, 0);
    policy->setSpacing(0);
    policy->addItem(buttonWidget(),0,0);
    layout->setPolicy(policy);
}
void MColorComboBoxViewPrivate::updateTitle(const QString &title)
{
    buttonWidget()->setTitle(title);
    popupWidget()->setTitle(title);
}
void CMakeKitConfigWidget::manageCMakeTools()
{
    Core::ICore::showOptionsDialog(Constants::CMAKE_SETTINGSPAGE_ID,
                                   buttonWidget());
}