Example #1
0
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); */
}
Example #2
0
egx_wnd_t egx_checkbox_create_(int res_id,char *name,egx_uint32_t style,int x,int y,int width,int height,egx_wnd_t parent)
{
	QCheckBox *button = new QCheckBox((QWidget*)(parent));
	button->setText(QString::fromLocal8Bit(name));
	if(x == 0 || y == 0){
		button->resize(width,height);
	}else{
		button->setGeometry(x,y,width,height);
	}
	return HWND_TO_GUIWND(button);
}
Example #3
0
/*
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;
}
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);
}