Align Icons and text in QListView centered - alignment

I want to align the items in the QListView centered like on this image:
Currently I manage to aligenn them only left:
In the property inpector of QtCreateor I have found nothing related to alignment. Also the style-sheet documentation for QListView tells nothing about the alignment.
Is this only to acheive using custom delegates?

I think you will have to subclass the QStyledItemDelegate object which is responsible to customize the rendering of your items.
Here is a link to the doc.
There are also some samples availaible on the Qt website:
Star Delegate
I comming back if I find a solution: I need the same effect as yours.

Related

How to create modern segmented control?

I was wondering how to create a segmented control with just the bottom border like this:
I searched everywhere but I can't find an updated answer because they have just updated how segmented controls look. If anyone could provide the code or get me on the right track it would be very helpful.
I use this link one time Custom segment Button With CGRect
you should try to draw the segment button on a path and you can give any specification you want.

Resizing the TMainMenu

I'm relatively new to programming and my problem is with a TMainMenu on my form.
I researched a lot (a whole lot) of sites for a solution, but haven't found any that solves this exact problem.
The main menu won't resize, not even when I change the fontsize using Screen.MenuFont.Size. I tried setting the Height property in the OnMeasureItem handler, I tried resizing the images and sub-menuitems at both design- and runtime, I even tried capturing Windows' message WMDrawItem and changing it's parameter before passing it on...
The menu items in the component are resized accordingly, but the vertical height of the menubar itself isn't. (the line seen on the picture below cutting through the icons)
Is there an easy solution to this, like setting some well hidden height property somewhere?
Or do I have to rewrite half of delphi's code to achieve my goal?
Help with code examples are appreciated. :-)
Here's an image:
I am using Delphi 7 on a Win7 machine.
The height of the menu bar is a Windows metric setting. Thus it is valid system wide - not only for your application. If at all, it can only be changed via the display settings of Windows itself.
I would recommend to use TActionMainMenuBar instead. It is much more flexible then the TMainMenu.
You can change the font of the menu bar very easy as well.

Windows Phone Application Bar TextBox

I was wondering, if it is somehow possible to add a TextBox in the Application Bar area (the same way the Internet Explorer does), but I didn't find any information source about this. Have you any idea, how to accomplish this task?
You will not be able to add UIElements inside ApplicationBar as it is not derived from UIElement.
Alternatively, you can try adding a Grid at the bottom of the screen and color it similar to the ApplicationBar. Then add a TextBlock inside the Grid. This is just a workaround and not recommended as it is not according to the standards.
You can also check the following link:
http://www.maxpaulousky.com/blog/archive/2011/01/10/bindable-application-bar-extensions-for-windows-phone-7.aspx

Does this UIBarButton exists by default in iOS? How is it called

I think I've seen this kind of button before, and now I need one.
A button like the one below who's label can be changed to whatever number I need (from 2 to 10 for example).
I have a feeling that this exists by default in iOS SDK but I can't seem to find it.
Does it exist by default or do I have to create it myself?
Thanks!
Its easy to replicate. Add a new RoundRectButton in interface builder, then in the attributes inspector change the type to Custom. Set the BackgroundImage to an image similar to above, and then set the Title to the number. By default the title will centered in the button, but you can use the Inset options in the attributes inspector and nudge the title in and down using the Top and Left inset attributes.
No, it's not a default item as far as I know. You can see all the default items in the Apple Human Interface Guidelines (see "System-Provided Buttons and Icons").

What UI element might this be? (Custom tab-bar?)

http://www.flickr.com/photos/fraserspeirs/4329430635/in/set-72157623224262135/
The above is a link basically showing the form fill view of the numbers app on the iPad. Any idea as to how to achieve such a functionality which sort of looks like our vanilla tabs on Chrome?
You could do it with just buttons set to Custom type and using an image for the background. Then when they are clicked, bring the specific UIView to the front.
To create the tabs from a single image use UIImage's stretchableImageWithLeftCapWidth: topCapHeight:
http://tcninja.blogspot.com/2010/09/ios-adding-stretchable-uiimage-as.html
This will let you dynamically set the image's width in a way that will use the middle of it to fill the new area rather than stretching (and warping) the outer edges.
I would have implemented this with simple UIButtons. All you need to do is to style them (pngs or whatever), and track which one is the current.

Resources