Icon of items is not visible in Qlistwidget - qlistwidget

I am trying to fill the Qlistwidget in IconMode. I am calling a function for filling Qlistwidget from a thread class. In result, i am able to fill the items in widget but all the items are without icons. For filling the widget, i am using this:
QListWidgetItem *Items=new QListWidgetItem();
QFont f;
f.pointSize();
Items->setFont(f);
Items->setFlags(Qt::ItemIsEnabled);
Items->setIcon(QIcon(QPixmap::fromImage(QImage(filename))));
ui->listWidget->addItem(Items);
ui->listWidget->setWrapping(1);
Items->setSizeHint(QSize(100,100));
Items->setFlags(Items->flags()|Qt::ItemIsUserCheckable);
Items->setFlags(Qt::ItemIsEnabled|Qt::ItemIsUserCheckable|Qt::ItemIsSelectable);
Items->setCheckState(Qt::Unchecked);
Items->setToolTip(filename);
Can anyone tell how to get the icon of thumbnails in Qlistwidget ?
Thanks,
Ashish

Related

UIViewController as a popup in Xamarin iOS

In the current project,I am using an UIViewController with 2 text Fields and a text area.
Text fields are used as drop-down (custom logic) and based on drop-down selection information is displayed in text area for e.g. State and city are two drop down. On click of State drop down city data is populated in second drop down and on selection of city corresponding info is fetch and displayed in Text-area.
I have a requirement to move this logic to custom popup. Can anyone guide me how to achieve this with minimal changes in Xamarin iOS.
It would use UIPopoverController in this care. You already have a view controller with all the UI elements. You can use it as the DetailViewController so you don't have to change that much. Only it's size and the background. You can use it for both iPhones and iPads.
Here you have a sample project with source code:
https://developer.xamarin.com/samples/monotouch/Popovers/
Create a new UIViewcontroller in the storyboard, set the background colour of the main view to transparent, then create another view on top of that and put in any controls you want to display etc. then in the UIViewcontrollers init method add in the following:
public OverlayView(IntPtr handle) : base (handle)
{
ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
}
That way the background view that you've set as transparent won't just show black, it'll show in the context of the screen that called it, then you just present it as you would any other view, and add in some dismiss action events if you want it to pass data back etc. Hope this helps.

How to draw text on PDFKit's PDFView's background

I Want to write a text message, typically "Drag & Drop a PDF here" on PDFView's "background" view. By background view I mean the matte gray view displayed when no PDF document is set.
Based on documentation, I was only able to change the background color (default is gray) using
(void)setBackgroundColor:(NSColor *)newColor
Any idea how to implement this?
Thanks in advance.
Based on Willeke answer, I was able to put a label on top on my PDF view using the Z indexes.
In interface builder, the lower the item in the list, the higher the z index.
Thus in my example, I dragged and dropped the label under the PDFView.
Note: you need to launch the application to see the result, the preview will not show the label.

How make button in NSWindow clickable while a sheet's on top of it

I have created a custom (themed) NSWindow, by creating a borderless window and then recreating all elements of the window border/background inside the content view. I've created the window widgets (close box, zoom box, minimize box) on top of my own fake title bar using -standardWindowButton:forStyleMask:.
Trouble is, when a sheet is presented on top of my custom window (e.g. "save changes...", those buttons do not receive the clicks.
Does anybody know how I can tell NSWindow not to intercept the clicks in my minimize box? It works with a standard NSWindow. When a sheet is up, I can still send both of them to the dock, or zoom the window out.
I thought maybe there's special code in the content view that ignores clicks in subviews while a sheet is up. But it seems as if -hitTest: is called on the content view and returns the minimize widget, but the widget's action never gets triggered.
I guess I could just replace the content view and perform the action in the content view's hitTest if it is the minimize widget ... but that seems a bit ugly.

AppBar in WP7.5 Panorama page

I'm currently developing a Windows Phone 7.5 app with a panorama page.
At the panorama page, I'm implementing an appbar to deal with several things in the app, such as displaying phone location in a Bing Map which is located in one of the panorama page items.
Now, I believe I have two options, but I don't know how they would work (if they even do work...):
Show only appbar icons relevant to current page/item
If you're not at the respective page/item, redirect to the page/item when clicking the appbar icon.
Would any of these actually work? Could I set an ID for each of the panorama items, and then make either 1 or 2 to work?
Thanks :)
Both are possible to accomplish.
For showing only the appbar icons relevent to the page you can use the Panorama.SelectionChanged Event:
var currentPanormaItem = ((Panorama)sender).SelectedItem
if(currentPanormaItem.Equals(firstPageItem))
{
// Set AppBar icons for first page
}
else if(currentPanormaItem.Equals(secondPageItem))
{
// Set AppBar icons for secondpage
}
If you know which panorama item is selected you can set the appbar icon accordingly.
Changing the selected item of a Panorama can be accomplished like this:
panoramaControl.DefaultItem = panoramaControl.Items[indexToSet];
Though changing the selected index of a Panorama is possible, I would advise using a Pivot control. With a Pivot control it is easier to keep track of the selected item and you get a nice animation when you programatically switch the selected page.

HorizontalFieldManager animation in Blackberry

Can I animate the HorizontalFieldManager in Blackberry?
I have a button in the bottom bar of the screen, and there is an array of images which display in a horizontal layout above the button.
When I click on the button, there should be a slide-in slide-out effect and the images appear one after the other.
Can anyone suggest me any tutorial or link for this?
I think the working approach will be in implementing your own custom bitmap field and placing it above the button, you want to press. When button is pressed, then intercept this event and update contents of your custom bitmap field.
Here is an example, how to create a custom field with RIM SDK.

Resources