I want to change the default QMessageBox title to something else, so that I don't have to call setWindowTitle for every individual message box.
How is the default window title chosen?
Best way to do this is to subclass QMessageBox, e.g.:
class MyMessageBox : public QMessageBox
{
MyMessageBox() //<-- default constructor
{
setWindowTitle("Default title goes here"); //QMessageBox function
}
};
Use MyMessageBox everywhere in the code.
You could instead add a TARGET in the .pro file. e.g. add this line to the .pro file:
TARGET = MyApp
Thus "MyApp" will be applied both as the executable file name and also as default value for windowTitle of all QMessageBoxes in the entire project.
You don't need to call setWindowTitle method while you can title when you instance the QMessageBox object.
On Windows developing with VC2008 it takes the name from the project. Change the name of the project and it will change the title.
Related
I set the View controller-based status bar appearance to NO on info,plist. I also set application.statusBarHidden = true but status bar reappears automatically when the QLPreviewControl is presented. I don't want statusbar on my application. How could it be hidden?
QLPreviewController works for you from the separate system process via XPC. That's why everything you trying to change on it could be not actually changed on the real instance.
Also it manages status bar in its own way depending on full-screen mode (e.g. when you open PDF file and make tap on the navigation bar).
However, you can subclass it and try to override your properties in your own controller.
Try to set/override in subclass following properties:
modalPresentationCapturesStatusBarAppearance = true
prefersStatusBarHidden = true
setNeedsStatusBarAppearanceUpdate()
Could be that you will have to restore status bar hidden state after user tapped on navigation bar to hide and then tapped again to show it.
I had the same problem and found a similar solution. In Objective-C, these steps worked for me:
Subclass QLPreviewController. In the .h file, add #import QuickLook;.
In the .m file, add this method:
- (BOOL)prefersStatusBarHidden {
return YES;
}
In the info.plist, if the Boolean property “View controller-based status bar appearance” is present, set its value to YES.
In your AppDelegate class, add this line to didFinishLaunchingWithOptions:
[UIApplication sharedApplication].statusBarHidden = YES;
If your info.plist file already has "Status bar is initially hidden” set to YES, step 4 may not needed.
I`m developer blackberry and try create to new attribute under to contacts but not set knows determineattrib correctly.
Code:
ContactBuilder builder;
builder.addAttribute(ContactAttributeBuilder()
.setKind(AttributeKind::Name)
.setSubKind(AttributeSubKind::NameGiven)
.setValue("NAME_test"));
...
other attributes
...
builder.addAttribute(ContactAttributeBuilder()
.setKind(ContactAttributeBuilder::determineAttributeKind("Attr_test"))
.setSubKind(ContactAttributeBuilder::determineAttributeSubKind("SubAttr_test"))
.setValue("1234567890"));
...
With other default attribute no problem.
I found a example:
https://supportforums.blackberry.com/t5/Native-Development/Gmail-synchronization-removes-some-attributes-from-contacts/td-p/2676999
result:
http://i.stack.imgur.com/wzh3s.png
The problem is that not show the attributes ("Attr_test" and "SubAttr_Test")names in the contact.
¿How adding a icon, label and link for app on attribute from the application?
thanks !!!
A photo you add with:
ContactBuilder.addPhoto()
https://developer.blackberry.com/native/reference/cascades/bb__pim__contacts__contactbuilder.html#function-addphoto-photo-isprimary
A link to a website you could add with AttributeKind::Website.
https://developer.blackberry.com/native/reference/cascades/bb__pim__contacts__attributekind.html#enumvalue-website
I don't know what kind of label you want to add but you would have to use one of the AttributeKind::Type enum values to add a label.
I have a Grid, which have a TopToolbar and BottomToolbar. In the BottomToolbar, I added a CSVDataExporter:
CSVDataExporter csvDataExporter = new CSVDataExporter();
csvDataExporter.setDataFormatNameModel(new ResourceModel("csv.export.link.name"));
csvDataExporter.setDelimiter('|');
addBottomToolbar(new ExportToolbar(this).addDataExporter(csvDataExporter));
I have the link, so I can export the table to CSV fine!
BUT! How could I change the CSV export link to be a Button, but do the same and be at the same place as it was? Thank you!
The Link is generated by your ExportToolbar using the createExportLink method. To generate something else (as in any other component) you can extend the ExportToolbar to override this method. If this is the only place where you need this functionality, you can do so by implementing an anonymous inner class.
Generally you'll want this method to return a Component that has it's own markup, like a Panel, that contains whatever you want to display as your Exportlink or -button.
I need to create an application in which we are changing the style of the application that is theme of the application based on the button click.
I have download the theme that all contains different CSS file. I need to dynamically declare the CSS for the application to apply that theme.
I have file name Theme1.css, Theme2.css, Theme3.css, Theme4.css, Theme5.css.
when I click on the Theme 1 Button then I need to apply Theme1.css file as source of style. similar like that when I click on the Theme 2 Button then I need to apply Theme2.css file as source of style.
Note : css file contains Style for both application and component of the Application.
Have a Nice DAY....
You would have to use the facility within eclipse/flex builder to compile the CSS into SWF so that the styles can be changed at runtime.
You would also have to maintain the instance variable of the current theme id.
Is this what you are looking for?
public function switchTheme(theme:int):void {
StyleManager.unloadStyleDeclarations("assets/styles/Theme"+currentTheme+".swf");
StyleManager.loadStyleDeclarations("assets/styles/Theme"+theme+".swf");
this.currentTheme = theme;
}
You would then assign the click handlers for each button to the switchTheme function - passing the theme id as a parameter.
I think you have to loop all control one by one and set theme on control.
for Eg.
If you set default theme RED and button is red then you change theme to Blue then you set button color to blue using looping of control.
May be this help to you....
Please ask me if you not getting what i am saying...
Thanks.
You need to compile your CSS files as SWF. You can right-click the CSS files in Flash Builder's explorer window and select "Compile CSS to SWF" from the menu.
Then you use the loadStyleDeclarations() method from StyleManager to load the SWF file with your CSS info.
The previous step will only add the new styles to your style subsystem. If you want to clear the old styles, you need the unloadStyleDeclarations() method first.
If you unload the currently active CSS declarations, use false as the second parameter so StyleManager does not invalidate the styles and rebuilds the style declaration chains/cache for the components on stage. This is not only be slow, but will also result on a screen refresh with the default styles before applying the new styles.
You could have something similar to this, and call applyTheme('url/to/theme.swf') with the appropriate URL whenever you want to change the theme:
private var currentThemeURL:String = 'themes/default.swf';
public function applyTheme(themeURL:String):void
{
StyleManager.unloadStyleDeclarations(currentThemeURL, false);
StyleManager.loadStyleDeclarations(themeURL);
currentTheme = themeURL;
}
Flex 3 question:
I trying here to avoid having to bind resources to all my components labels ( ie a button) and find a way to have this automated.
Problem:
It corrupts the layout in design mode to bind directly in the mxml label="{resourceManager.getString('myResources', 'submit')}" and makes the design view useless. but when declaring bindings elsewhere, in actionScript or via a bind tag, it is counter productive and prone to many errors and miss.
Proposition:
I would like to create my own button that automatically invoke resources to localize a button label. So the author puts "Submit" in the mxml description of my button, and when running it would take the value of the label ie "submit" and use resourceManager.getString('myResources', 'submit').
but I can't find the way to override the set label function, Is it possible if yes how? else how can I go about it?
Maybe I am missing an essential process here that would make the use of resources more elegant, as well as how to override such thing as a button's label.
Thanks for your advices.
Create a component called MyButton, extending Button. Then use this:
override public function set label(value:String):void {
super.label = resourceManager.getString('myResources', value) || value;
}
Assuming the resource manager returns "null" or "undefined" this will work, and will only replace the value if it exists in "myResources".
If you don't want to override every component you need to do this with, then you can add a FlexEvent.CREATION_COMPLETE event on every component. Then use a single generic function to do your label localization.