PDA

View Full Version : tab & plugin



fpujol
23rd April 2007, 10:01
Hello,

I'm creating a plugin for Qt Designer, it's a simple QLabel and QLineEdit. When I use it in the designer I cannot set the tab order to the plugin. How I can do it ? it's a property ?

Thank you.

wysota
23rd April 2007, 10:44
Of the plugin or of the line edit and label? If the latter, then it's not possible as the custom widget is treated as a single whole, not as two separate widgets. So if you want to set the tab order, set it when designing the custom widget and not when using it in Designer. If the problem is the former, then you might need to set a focus proxy for your custom widget.

fpujol
23rd April 2007, 12:29
Hello Wysota,

The tab order is for plugin. I tried the setFocusProxy without exit. This is my code of my custom widget:


AKLbField::AKLbField(QWidget *parent, Qt::WFlags f)
: QWidget(parent, f)
{
createObjects();
init();
}

AKLbField::~AKLbField()
{
}

void AKLbField::createObjects()
{
akLabelName = new AKLabel();
akFieldEdit = new AKField();
setFocusProxy(akFieldEdit);

QHBoxLayout *qHBoxLayout = new QHBoxLayout();
qHBoxLayout->addWidget(akLabelName);
qHBoxLayout->addWidget(akFieldEdit);

QVBoxLayout *qVBoxLayout = new QVBoxLayout();
qVBoxLayout->addLayout(qHBoxLayout);
setLayout(qVBoxLayout);

}

When I go to the designer I cannot assign tab order to my custom widget whole.

wysota
23rd April 2007, 12:50
What does it mean that you can't? The square with a number doesn't appear next to your widget or what exactly happens?

fpujol
23rd April 2007, 13:48
Yes, the square with the number doesn't appear

wysota
23rd April 2007, 13:58
Change the focus policy of your widget to something different than NoFocus.