On the QML and C++ integration (getting "undefined")
This subject has been discussed often and I went through a lot of discussions, but I have not found a solution for my problem so far.
What I want to do in my application:
I have a container that displays an html page. No, I want a part of the html page dynamically filled a C++ function. Here is my Code:
// HTMLCreator.hpp #ifndef HTMLCREATOR_HPP_ #define HTMLCREATOR_HPP_ #includeclass HtmlCreator : public QObject{ Q_OBJECT Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) public: HtmlCreator(QObject *parent = 0); ~HtmlCreator(); Q_INVOKABLE QString html(); Q_INVOKABLE void setHtml(QString html); signals: void htmlChanged(QString); private: QString m_html; }; #endif /* HTMLCREATOR_HPP_ */
// HtmlCreator.cpp#include "HtmlCreator.hpp" #includeQString HtmlCreator::html(){ return m_html; } void HtmlCreator::setHtml(QString html){ if(html != m_html) { m_html = html; emit htmlChanged(m_html); } }
// applicationui.cppPage* ApplicationUI::doLoadPageDetails(){ qmlRegisterType("myHtmlCreator", 1, 0, "HtmlCreator"); QmlDocument *qml = QmlDocument::create("asset:///PageDetails/PageDetails.qml").parent(this); qml->setContextProperty("app", this); HtmlCreator *HtmlCreator = new HtmlCreator(); qml->setContextProperty("HtmlCreator", HtmlCreator); Q_INVOKABLE QString HTMLString = ""; HTMLString.append(" "); HTMLString.append("Aa"); MinutesData->setHtml(HTMLString); Page* newPage = qml->createRootObjectBb(); AbstractPane *root = qml->createRootObject (); return newPage; }
// PageDetails.qml import myHtmlCreator 1.0 Page{[...]Container { layout: DockLayout { } horizontalAlignment: HorizontalAlignment.Center verticalAlignment: VerticalAlignment.Top ScrollView { id: scrollView1 scrollViewProperties { scrollMode: ScrollMode.Vertical } layoutProperties: StackLayoutProperties { spaceQuota: 1.0 } scrollViewProperties.pinchToZoomEnabled: false scrollViewProperties.overScrollEffectMode: OverScrollEffectMode.None visible: true WebView { id: webViewScrollable1 // url: "local:///assets/examples/test4.html" settings.viewport: { "initial-scale": 1.0 } settings.zoomToFitEnabled: false settings.textAutosizingEnabled: false settings.defaultFontSizeFollowsSystemFontSize: true settings.imageDownloadingEnabled: false settings.binaryFontDownloadingEnabled: false settings.cookiesEnabled: false settings.javaScriptEnabled: false settings.activeTextEnabled: false html: " ... lots of html code displayed correctly" + HtmlCreator.html + "" + "" } }
Now to the point where with HtmlCreator.html do I put her thong in the app I see "undefined" text
What I'm doing wrong here?
I found the solution!
I missed to add my class as an attached object. So the container, the label or in my case WebView where I want to use the Q_Properties defined in my class, I have to add:
attachedObjects: [ HtmlCreator { id: htmlCreator } ]
and then I can get the property
htmlCreator.html
But unfortunately
the string I get is empty, so I'm still something missing here.
Tags: BlackBerry Developers
Similar Questions
-
QML and C++ integration
I have a problem with QML and C++ integration.
I have second attached to hand qml (next to main.qml):
attachedObjects: [ ComponentDefinition { id: dataPage source: "dataPage.qml" } ]
When the subject is raised in the listview, this page is pushed in navigationPane:
onTriggered: { var selectedItem = dataModel.data(indexPath); var page = dataPage.createObject(); page.name = selectedItem.title; navigationPane.push(page); }
ApplicatonUI::ApplicationUI(bb::cascades::Application *app):QObject(app)...dataPageqml = QmlDocument::create("asset:///dataPage.qml").parent(qml); dataPageqml->setContextProperty("pageC", this); ...} void ApplicationUI::processChoice(){ Page *page = dataPageqml->createRootObject
(); page->setProperty("label", "New text"); } DataPage.qml I call onCreationCompleted to call the processChoice() function:
Page { id: page onCreationCompleted: { pageC.processChoice(); } property string name Container { WebView{ horizontalAlignment: HorizontalAlignment.Fill minHeight: 700.0 maxHeight: 700.0 } Label{ id: lb objectName: "label" text: page.name } } }
In this case, I want to change the text in the label, but nothing happens.
What I am doing wrong?
Ty for answers.
Change
QML-> setContextProperty ("INAC", this);
TO
QmlDocument::defaultDeclarativeEngine()-> rootContext()-> setContextProperty ("INAC", this);
-
Reactivate microsoft reader, but when I get on the site and I try get a 500 Server error
Original title: 500 Server error.
I'll have to re-enable the drive of microsoft, but when I get to the site and try I get a server 500 error is it possible around that I have hundreds of books with a value of eBooks that I can't access
Original title: 500 Server error.
I'll have to re-enable the drive of microsoft, but when I get to the site and try I get a server 500 error is it possible around that I have hundreds of books with a value of eBooks that I can't access
Problem solved by other means.
-
I tried to install the updates and I keep getting the message of failure on the important updates. An error code I see repeatedly is 80070643, anyone know what it means?
Hello
Follow the information below
Windows Update error 80070643
Windows Update error 80070643 can happen for several reasons. The most common cause is a problem with the .NET Framework is installed on the computer. You can also encounter this error when installing updates for Microsoft Office 2003. If you were installing Microsoft Office 2003 updates when you received the error, follow the instructions in the "Microsoft Office 2003" section below. Otherwise, follow the instructions in the section "Windows.NET Framework".
http://Windows.Microsoft.com/en-us/Windows-Vista/Windows-Update-error-80070643
_______________________________________________________________
If above does not solve it:
Please repost your question in the correct windows update forum
http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update?page=1&tab=all
-
Help, I have a problem with the PS and CC - I get and error measure in PS - "this program cannot start because ONCoreFoundation8.dll - is missing... and it crashes, and now creative cloud will not be open to all." I spent more than 2 hours to speak to someone in tech support that I did not understand, and I don't know what to do next. The tech gal was run, but once she hung up he returned to broken. I have an idea, but that's just a guess - trouble started about the time I tried to open On1 of ps there has been a perfect icon effects 9 (for some reason, they decided to add the icon when I got it - I have 8) I clicked it and it loaded the update and then asked me if I wanted to try or buy - that's when I realized that I should have clicked on 8 and tried of back , but is either too late - I think, maybe this dll. 8 or 9 in with perfect On1 effects - and it has changed my settings in PS - and is the reason why it is not compatible - ideas? I have a pc with window7-Carol
Try to run Photoshop without loading third-party plug-in. hold SHIFT keys when you start Photoshop. The missing module is not Adobe software.
-
I downloaded the application, and all I get is a black screen. It will not start what is wrong?
-
Problems to regain the QML C++ enum; JS is undefined instead of an int.
I followed the path of BB to regain the enums in C++ QML discussed here:
http://supportforums.BlackBerry.com/T5/native-development/HOWTO-C-enum-in-QML/m-p/2345641#M21139
However I'm getting back the value JS "undefined" of my logic of C++ biz instead of what I want (i.e., an integer that corresponds to my enum type).
The scenario is that I want to restore the data from the application of a backup and do a lot of validation of each step of the restore if something goes wrong, I can post a dialogue of restoration has failed no credits that could help the user recover.
I have a class enum setting as follows:
#ifndef RESTOREFAILURETYPE_HPP_ #define RESTOREFAILURETYPE_HPP_ #include
class RestoreFailureType: public QObject { Q_OBJECT Q_ENUMS(Type) public: enum Type { Success = 0, JSONReadFail = 1, UndoFileRemoveFail = 2, CopyToUndoFail = 3, DestFileRemoveFail = 4, CopyBackupFileFail = 5, ValidateSchemaFail = 6 }; RestoreFailureType(); // Empty constructor defined in .cpp file virtual ~RestoreFailureType(); // Empty destructor defined in .cpp file }; #endif /* RESTOREFAILURETYPE_HPP_ */ I save this class as an increables type in my app delegate:
qmlRegisterUncreatableType
("myApp.restoreFailureType", 1, 0, "RestoreFailureType", "RestoreFailureType provides enum values. It cannot be instantiated."); I have a DataManager class that takes care of managing the operations of store, backup, restore, etc CRUD/user support, with what restoration function:
In DataManager.hpp:
Q_INVOKABLE RestoreFailureType::Type restoreFromBackup(QString backupFileName, int selectedIdForUndo);
in DataManager.cpp (here I show a fake draft. Since not even that much is still working, the rest of the logic of biz is not relevant to this discussion:
RestoreFailureType::Type DataManager::restoreFromBackup(QString backupFileName, int selectedIdForUndo) { return RestoreFailureType::Success; }
And in my QML UI layer, I import the type:
import myApp.restoreFailureType 1.0
And a FilePicker component supports passing the name of the backup file to the DataManager. The FilePicker and his onFileSelected() slot:
FilePicker { id: backupRestoreFilePicker type: FileType.Other allowOverwrite: true directories : ["/accounts/1000/shared/documents/MyApp"] viewMode: FilePickerViewMode.ListView onFileSelected: { if (mode == FilePickerMode.Saver) { // Save mode stuff for doing backups } else if (mode == FilePickerMode.Picker) { var restoreResult = _dataManager.restoreFromBackup(selectedFiles, _appSettings.selectedId); } } }
I tried to remove the code down for everything that is relevant to this question.
When I put a breakpoint on the line where the var restoreResult JS is defined:
var restoreResult = _dataManager.restoreFromBackup(selectedFiles, _appSettings.selectedId);
and step, restoreResult, var JS becomes the value "indefinite". From what I read in the thread mentioned above, restoreResult is supposed to get a whole number (in this case he should get zero method justiciable restoreFromBackup how I generated), that I can then compare to imported enum type. I should be able to compare the return value of restoreFromBackup to see if it is equal to one of:
RestoreFailureType.Success // or: RestoreFailureType.JSONReadFail // or: RestoreFailureType.UndoFileRemoveFail // or: RestoreFailureType.CopyToUndoFail // etc...
I think others have got it working, and miss me him probably just a few details. A lot of satisfaction to anyone who can identify the error/omission or even give a good lead. In addition, comments are welcome on if I'm trying to manage this scenario in a recommended manner. My intention is to use the listed failure code to customize a SystemDialog message that may help the user recover from a restore operation has failed. The restore file might have been corrupted in a way that is not analyzable JSON, or the user could have selected a file that isn't even a backup file created by my application, or they could have revoked authorization, or JSON can be analyzable, but the user could not resist the temptation to manually change the values in their backup file etc.
Hmm,
Sometimes all you have to do is to talk, even if you speak to yourself.
I changed my function DataManager to return my type listed as int instead of as the enum, and I don't have the correct integers in QML, anything can still be compared using the enumerated type. So:
Q_INVOKABLE RestoreFailureType::Type restoreFromBackup(QString backupFileName, int selectedIdForUndo);
becomes
Q_INVOKABLE int restoreFromBackup(QString backupFileName, int selectedIdForUndo);
and
RestoreFailureType::Type DataManager::restoreFromBackup(QString backupFileName, int selectedIdForUndo) { return RestoreFailureType::Success; }
becomes
int DataManager::restoreFromBackup(QString backupFileName, int selectedIdForUndo) { return RestoreFailureType::Success; }
and I can do now:
var restoreResult = _dataManager.restoreFromBackup(selectedFiles, _appSettings.selectedId);if(restoreResult == RestoreFailureType.Success) { // Do success stuff} elseif(restoreResult == RestoreFailureType.JSONReadFail { // Do JSON read fail stuff} else...
This isn't quite how it was recommended in the thread, I mentioned in the previous post... but it seems to work for what I need.
-
improve the WCS and WCC integration / sync activity
Hi all
We have WCS integrated with WCC as backend storage of content. We use the STANDARD connector for integration between these 2 products suites. On check in content to the WCC, she undergoes life-cycle activities normal document and then contentid is placed in the queue of the integration table. Queue information will be collected and WCS will be synchronized with the information in document OWCC.
This whole process takes longer (approximately more than 1 min) and users are not able to find the documents that they created immediately.
Let know what steps can help solve or improve this performance. We did the analysis and concluded that unless the State of the document is PUBLISHED in the OWCC, information will not be placed in the queue table and synchronization of content is getting delayed.
Indications will be very useful.
The OOTB 'connection' is a polling station synchronization process (heart draws OWCC). It is not realistic to expect, it is a process in real time. It can be as fast as the slowest part of the process - if you want Sites to poll more frequently change the "timing" in the system events. The desire to increase the frequency of audit of heart - but this will solve is not the question of the time it takes to the WCC from "creation of loan".
If you want it to be more 'real-time', you need to create your own 'connection '.
The folks over at Function1 and BezzoTech (https://www.youtube.com/watch?v=qVTS--OS78o) has created an interesting link where 'Document' is actually created in the OWCS UI and then automatically pushed in WCC and Sites 'at the same time;
-
define the users for the studio and server Integrator
Can you get it someone please let me know how to set the users for the studio and Integrator server so that the user can be used to display the page in the user interface but not change. I want to set the studio user that will access the Page but not modify it. And the user at the server of the Integrator must be able to view scheduled tasks.
Thank you very much.
Kind regards
AmritAmrit,
Points are awarded automatically when you mark an answer (5 pts) useful or correct (10 pts).
Is there a help icon in the label of the legend for the different rankings. The answer to your question is on this page.
RLJII
-
I recently put a password on my computer and when I tried to connect then it would not accept the password. I tried many times to enter the correct password, but it won't let me. Is it possible to get on my userspace without this password?
Hi rosie19va,
Welcome on the site of Microsoft Windows Vista Community.
Method 1: You can try to boot to the desktop in Mode safe mode (how to start safe mode: http://windows.microsoft.com/en-us/windows-vista/Start-your-computer-in-safe-mode), if you are able to boot to the desktop, you can create a new account from safe mode using the default Administrator account and move all the files and documents in the new user account. Follow the link to create a new user profile and set a http://windows.microsoft.com/en-us/windows-vista/Fix-a-corrupted-user-profile corrupted user profile
Method 2: What to do if you forget your Windows password
http://Windows.Microsoft.com/en-us/Windows-Vista/what-to-do-if-you-forget-your-Windows-password
I would say that you can create and use a password reset disk in Windows Vista; see the link to create a password reset disk: http://support.microsoft.com/kb/930381Let me know if it worked.
Hope it will be useful.
Thank you and best regards,
Vijay K - Microsoft Support
Visit our Microsoft answers feedback Forum and let us know what you think.[If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]
-
Program blocked because of the firewall, and can't get past it
Hello I really need help with this problem I've ever had. I have Windows Vista and I have Windows Live Messenger installed, and whenever I connect to my account it throws my connection to the internet. I tried to solve this problem by selecting this program to get through the firewall, and it did not work at all. Please can someone help?
Discussions in Windows Live Messenger
They will help you with your WLM questions when repost you your questions in the highest Windows Live Messenger Newsgroup.
See you soon. Mick Murphy - Microsoft partner
-
What to do if I deleted the menu layer on the left and want to get it back?
Hi guys. I use photoshop and I deleted the menu layer on the right with the colors and all the layers. How can I get that menu back?
Press F7 or go to the main menu and select Windows > layers.
-
I can somehow gives you a screen shot to show you the detail? How do give you it?
The reset Firefox feature can solve a lot of problems in restaurant Firefox to its factory default condition while saving your vital information.
Note: This will make you lose all the Extensions, open Web sites and preferences.To reset Firefox, perform the following steps:
- Go to Firefox > help > troubleshooting information.
- Click on the button 'Reset Firefox'.
- Firefox will close and reset. After Firefox is finished, it will display a window with the imported information. Click Finish.
- Firefox opens with all the default settings applied.
Information can be found in the article Firefox Refresh - reset the settings and Add-ons .
This solve your problems? Please report to us!
-
Devastated to find that the new AppleTV works great on Airplay / mirroring with the iPhone and iPad devices but completely useless on the NEW laptops.
Trying to show any video for example utube creates immediately hop on the TV screen when you use the Macbook and in no time the WiFi connection is stunned.
What is going on?
I use ElCapitan, and the last 15 "16GB i7 Macbook MacbookPro and not expect a problem with streaming media.
Absolutely well on Airplay with bith an iPhone 6 Plus and also an Air iPad
This will be due to a network problem. There is a difference between mirroring of a phone/Tablet and grow to a full desktop in real-time
Mmake that there is no other activity (other streaming, web browsing, backup network etc.)
Try to connect the Apple TV via ethernet
To see a current state of the network to obtain a report of istumbler or similar. Look for the strength of the signal, noise, networks nearby
Test on another network
-
Hello
I configured a WLC to integrate with LDAP, it works fine when I use only one Active Directory server, but I have other users in the other Active Directory server. When I turn on both servers and some users try to log in with the second server WLC triggered for a little while it is impossible to set up the equipment nor the telnet that during that time, and users may not be authenticated more, I have to disable the server and then activate just one of them in the order users can connect again. I also saw this behavior when more than 4 users try to connect to the same access point at a time.
Anyone know why this is happening and how to avoid it?
Thank you very much for your help
Yes, it leads me to believe that your RADIUS is not configured correctly. I should make it clearer, but in order to make 802.1 x, you must have an IAS or ACS that extends from your ad (or LDAP, I suppose, but I am not sure that it is supported). You can't just point your controller to your ad, it does not work.
Maybe you are looking for
-
Satellite x 200 and strange question sleep
Hello I have a strange problem with this laptop.I have windows Vista and everytime I put it in sleep mode (the lid) everything stops, but I have observed that, after 30 minutes, the laptop restarts and stays like that until the battery goes dead. Tha
-
How can I reinstall the previous version of Firefox (v.3.6.16)?
I just installed Firefox 4. Norton Toolbar (5.5) is not compatible. Therefore, I would like to go back to the previous version of Firefox (I think it's 3.6.16) but don't know how to do.
-
Windows Mail suddenly asking for the password and then argues that it is incorrect
Hello. I have my Microsoft Windows Mail related to my TalkTalk email address, and this has worked well for years. There always was a case of just clicking in the start menu E-mail - login has been automatic. Until a few days ago... Now, when I click
-
original title: Windows activation problem. I have windows vista 64-bit. I installed 2 or 3 years ago and wanted to reformat because I bought a few new parts. So I reformatted and reinstalled windows, but it's now, it tells me that my key is invalid
-
read and write performance vm information top 10
Hello I wonder if it is possible to have some information about reading and write the totals of the IOPS / s and latency? The only one i have now in Explorer 'storage '. "VM performance top 10" is average information and tip of the Ops / s and latenc