Magnolia dialog size - magnolia

I have a dialog ( containing a form) with just one field, and I would like to make it as small as possible.
Does anyone know how can I set the size of the dialogue?
At the moment the dialog looks like this
And I would like something like this :

Can you try to set the dialogue to non-wide mode?
There is a boolean under dialog definition that you can set 'wide' to 'false'.
Cheers,

There's an attribute named wide which is Boolean.
Dialog documentation
By default wide is false, so you could just remove the
wide: true
attribute in the dialog definition.

Related

How to select tab programmatically?

I need to switch from current tab to another without clicking on the tab itself.
In Clarity's documentation, you can see that the *clrIfActive directive accepts a boolean input to force a tab to activate.
So in your case, just pass true to the *clrIfActive of the tab you want to programmatically select. How you do that depends on how you create your tab in the first place: statically, with an *ngFor, based on a specific tab model, ... We can't help you out more unless you provide an example of what you are trying to do.

How can I Define Visible Columns in a PickList, in zappdev

Inside my form, I have a picklist. But when I validate I get this type of error:
"No visible Columns defined". Does anyone know what to do?
After selecting the picklist, on the right side of the screen you can see its properties. There is a button called Column Options... you can select your visible columns from there.
https://www.screencast.com/t/QBar3gZk
Careful, if you have changed properties of the dataset model you might need to refresh your form before you can see the changes .

How to change maxVisibleItems in QFileDialog filter combobox

I have QFileDialog with 11 items in the filter. By default QComboBox shows 10 and for the rest you need to scroll - i.e. you have to scroll for 1 item. I would like to change it. QComboBox has maxVisibleItems property, but how can I access QFileDialog's filter combobox? I can see it in QDialogPrivate::qFileDialogUi->fileTypeCombo, but I don't have access to it.
Thanks!
The following solution only works for non native file dialogs (i.e. you must set the QFileDialog::DontUseNativeDialog flag).
In that case, QObject::findChild can be used to find the combobox in the widget. The following example assumes the dialog has only one combobox. If thats not the case, you must find the correct one via QObject::findChilden, which returns a list of all children.
Example code could look like this:
auto dialog = new QFileDialog(parent);
dialog->setOptions(QFileDialog::DontUseNativeDialog);
auto cBox = dialog->findChild<QComboBox*>();
if(cBox)
cBox->setMaxVisibleItems(11);
else
qCritical() << "Unable to find any combobox child";
//setup and show
Important: If you can't find the child, it's possible you have to first show the dialog before you can modify the box. In that case, place the code after the show call, and it might work.

Enabling richt text font (RTF) in QComboBox

I've to deal with a scientific application and thus have to use RTF at many place (think about displaying units with exponents mainly).
I've implemented a delegate to deal with tables and drop box and it works mostly fine. (implementation : http://pastebin.com/FuCbGqkY , header : http://pastebin.com/D6hxeWdF ).
However, I've been into a major issue : it looks like the "button" part of the QComboBox is not rendered with the delegate (it only applies to the drop down box). Is there any way to have the text in the combobox when it's not dropped displayed correctly ? If not, what do I have to do ? Subclass and overwrite paint method ? Looks like a lot of pain and basically it makes the delegate useless.
Any clue ?
Consider QComboBox::lineEdit() method. You can try to apply your changes to the QLineEdit directly if it's possible. Otherwise you can subclass QLineEdit and change its behaviour to what you want, and then insert it using QComboBox::setLineEdit. Maybe you will need to make the combo box editable in order to use this.

Passing variables from one form to another in Qt

I've got two forms, the mainform which opens up a dialog box that has a text box in it. How can I pass the text from the textbox back to the mainform? I've tried alot of different methods but I think I'm missing something simple. Thanks for any help.
The dialog box still exists after it closes. So you can, from the main form, do something like this:
QString text = subform->textEdit->text();
This assumes your dialog box is subform and the name you gave to the text edit box is textEdit. Make sure you make textEdit public in the designer.
If you don't want to make textEdit public, then you can add a getter to subform.
If you use the MVC pattern, you create the model object (container for your data) and pass to the text box to fill in the text value itself. When the dialog is closed, just read the value from the model and put it wherever you need it.

Resources