How to support rich text for QRadiobutton? - qt

I need to build a new class MyRadioButton which is inherited from QRadioButton and suport rich text.
Is there any method support directly in the class ? Or do you guys have any idea for this ? Otherwhile I think I'll have to build a new class which is combination of a QRadioButton (for the indicator) and QLabel (for the text) to form MyRadioButton.

Related

example to add custom properties in qt using QDesignerDynamicPropertySheetExtension class

I need to define new property using QDesignerDynamicPropertySheetExtension class, it would be helpful if anyone share the example for this

How to make QtDesigner offer Enumeration for Plugin Property

I'm trying to deploy my Qt Ui Widget as a Qt Designer Plugin in accordance to the Guide at https://doc.qt.io/qt-5/designer-creating-custom-widgets.html
However, I just can't seem to figure out how to make QtDesigner present the User with a Dropdown in the Property-Editor for Enumeration Properties.
Any suggestions are greatly appreciated!
Answering my own question:
1) put the enum right after the "public:" of your class and immediately thereafter use the Q_ENUM macro
class myEnumContainingClass {
Q_OBJECT
Q_PROPERTY(FOO my_property READ getMyEnumProperty WRITE setMyEnumProperty DESIGNABLE true)
public:
enum FOO {
BAR
};
Q_ENUM(FOO)
explicit MyEnumContainingClass();
...
2) use only the key of the enum, not the whole enum::string in the domXml()-section of the plugin like this
<property name="theEnumHoldingProperty">
<enum>BAR</enum>
</property>
Although I would have still preferred to have the whole enum::string appear in the Dropdown within Qt Designer for consistency, at least it works this way.

What is the proper way to create control in Xamarin Form PCL?

What is the proper way to create control in Xamarin Form PCL?
In my class library I have "control" class not derived from any View, just a layout with some labels, scrollviews, logic etc.
I am using it in my pages in the same PLC in several places.
My question is - what is the proper way to wrap this "control" and use it in PLC pages?
I ended up having this control class to expose its root layout where I add all the child elements and subsequently add this layout to the children of page layout. This makes this class to be some sort of a builder of a part of UI of a page.
It looks like that using "View" as a base class requires me to add custom renderers to Android and iOS projects
which I don't need to do - all my UI functionality fits into PCL withot the need for any custom work.
I have a feeling that I am not doing it the right way.
Advise and/or link to the documentation on how to properly do it will be greatly appreciated.
It seems to me that you're actually hurting yourself by not wanting to use a View as a base class. I commonly use ContentView as a base class to create my own controls and it works great without the need for a custom renderer since ContentView already has its own renderers in iOS and Android. Something like this should do the trick.
public class MyContentView : ContentView
{
private Layout createLayout();
public MyContentView()
{
Content = createLayout();
}
}

Monodevelop 2.8 Xcode 4 Custom class on xib UI Components

How do you set a custom class on a UI component in Interface Builder, so say I have a class in my project that extends UITableView how do I associate a component in Interface Builder to use that custom class? I type the class name into the custom class placeholder but it replaces that with UITableView...
Any Ideas?
Thanks
Make sure you have this mode active (the right hand side pane), your view selected and the third pane selected like this:
http://tirania.org/s/f6111a1a.png
Then just set the name of the class there. When you save the file and switch back to MonoDevelop, it will automatically stub the class for you if you are using Storyboards.
In order to make the class usable from Interface Builder (and Objective-C), you need to register it using an explicit name, for example
[Register ("MyTableView")]
public class MyTableView : UITableView
{
//...
}
Then MonoDevelop will be able to synchronize the class out to Xcode and it will be visible in Interface Builder.
Classes in project and xib/storyboard templates are already registered in this way, though the attribute may be in the partial designer class.

How to create "Available field" properties in my own property?

I have created a class inherit from StateManagedCollection.
It has got a few class as Columns like GridView.
But I can not select which filed I want to select from.
It should look like the picture below in design.
But mine is the one below:
I have written the property as below:
[Description("A collection of ToolBarItem's ")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Editor(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor)), PersistenceMode(PersistenceMode.InnerProperty)]
public virtual Items Items
{
}
Can anyone help me out?
GridView columns collection uses a custom UI Type editor to show this interface. The in-built ASP.NET CollectionEditor will not show the required UI. Further in your case, CollectionEditor may not work if the collection's item type is a abstract class.
Solution is to build your own custom UI Type editor - basic steps are
Inherit from System.Drawing.Design.UITypeEditor.
Override GetEditStyle method to inform the property browser that you will launch modal form.
Override the EditValue method to launch your custom UI form.
Build the custom UI Form.
See a couple examples here (see sample for TagTypeEditor) and here.

Resources