QML Qt openUrlExternally - c++

I've just discovered strange behavior when using this code
Qt.openUrlExternally(someurl);
I would like to let my users open facebook sharer url,
but I cannot use this code, as it does nothing.
Tested on S60 5th and Symbian^3 devices (C5, C7, 5230, N8)
So please tell me (if you know)
1) Is there any BUG about this component/behavior ? (I searched and didn't found anything)
2) How can i make C++ component to do the same thing ?` (If it is solution)
Thanks
Edit
I found example for creating C++ components with methods accessible to QML, right here: http://doc.qt.io/qt-4.8/qt-declarative-cppextensions-referenceexamples-methods-example.html
Final Edit
Discussion led to making a bug report, could be found on : https://bugreports.qt.io/browse/QTBUG-19201
Thanks everybody

Qt.openUrlExternally("http://www.stackoverflow.com/"); opens the native browser for me.
The only problem I have found with it is, if the browser is already running on the handset (in the background), it will not be brought in to the foreground, and therefore looks as though it has had no effect.

Try adding this to your .pro file
# Needed for bringing browser from background to foreground using QDesktopServices: https://bugreports.qt.io/browse/QTBUG-8336
TARGET.CAPABILITY += SwEvent
And it should bring the browser to the foreground.

Related

C++ gtkmm: FileChooserDialog not working with any drives

How do I browse local or especially network drives using Gtk::FileChooserDialog? I see all the drives including the network drives (I want to browse these), but when I click it, nothing happens or I am redirected to different folder.
Gtk::FileChooserDialog dialog("Please choose a folder",Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
dialog.set_transient_for(*this);
int result = dialog.run();
//go on with other code
Only browsing the shortcuts like Documents, Downloads etc. works. I'm using Windows 7 with gtkmm 3.0 if that matters. From explorer or cmd all drives are accessible of course.
EDIT: The behavior can be reproduced by compiling this code under Windows: https://developer.gnome.org/gtkmm-tutorial/stable/sec-dialogs-filechooserdialog.html.en and trying to browse drive C for example.
Can anyone manage to reproduce the same behavior?
Thx
Found a cause.
This is actually a bug (https://gitlab.gnome.org/GNOME/gtk/issues/170) reported few days before. The solution is to update your glib2 with the fix (https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-glib2/W32-gstdio-Dont-try-to-get-reparse-tag-uncondition.patch). Or wait/upgrade to glib 2.56.2.
After applying the fix, everything works at it should.

How to create a custom theme for QtCreator

I would like to create and share a free Qt app for easy creation of custom QtCreator themes. My problem though is not the creation of the app itself, but the format of the *.creatortheme file.
I have made a copy of the flat.creatortheme found under Tools\QtCreator\share\qtcreator\themes and since I can't find the names of the variables documented anywhere, I used the trial-and-error approach in order to figure out the meaning of the variables. For the most of them I've succeeded. However for the ones starting with Timeline_ and VcsBase_ I can't see any change in the visual appearence for my setup of the IDE (Qt 5.10.0, MSVC 2017, Windows 7).
So if I make that just for myself, that would be enough, but since I would like to share the app with the rest of you, I think I should cover those values as well.
Does anyone have an experience with this?
Any help will be appreciated.
In the source code of Qt Creator those are listed in the Color enum of the Theme class:
...
/* Timeline Library */
Timeline_TextColor,
Timeline_BackgroundColor1,
Timeline_BackgroundColor2,
Timeline_DividerColor,
Timeline_HighlightColor,
Timeline_PanelBackgroundColor,
Timeline_PanelHeaderColor,
Timeline_HandleColor,
Timeline_RangeColor,
/* VcsBase Plugin */
VcsBase_FileStatusUnknown_TextColor,
VcsBase_FileAdded_TextColor,
VcsBase_FileModified_TextColor,
VcsBase_FileDeleted_TextColor,
VcsBase_FileRenamed_TextColor,
VcsBase_FileUnmerged_TextColor,
...
According to the comments, they are used by the Timeline Library and the VcsBase Plugin.

GDK picture intent gets stuck on Tap to accept

Today the picture function on my Glass app stopped working. It was fine yesterday, but now it gets stuck on the Tap to Accept Picture. I think it may have something to do with the new (to me at least) way it handles pictures as well as the viewfinder. What I can find on the glass developers site is deprecated and doesn't work. My hope/belief is that the new idea is for the intent to go to the viewfinder and then take the picture. I'd prefer to still use the glass method, but I am aware of the android API camera method. Here's the code
startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), REQUEST_PIC);
and in onActivityResult
switch(requestCode)
{
case REQUEST_PIC:
String picturePath = data.getStringExtra(Intents.EXTRA_PICTURE_FILE_PATH);
processPictureWhenReady(picturePath);
break;
}
I have got the same problem since upgraded to XE18.3. Instead of spending time to look for a workaround, I've implemented the preview mode with SurfaceView. You could access the camera directly with Camera.Open(), the sample codes can be found at: (search for "camerasample.zip" in the page)
https://code.google.com/p/google-glass-api/issues/detail?id=351
Hope this helps.
This is a problem being experienced after the XE18.3 update. It has been logged in the google-glass-api issue tracker here.
You can try downgrading the firmware as mentioned in the comments, but be sure to note that doing that voids your warranty.
I have the same issue happening to me as well, however if you plug Glass into your computer that is running Eclipse and the adb is running the Intent will complete successfully. This is not a solution but hopefully it'll keep you from getting behind in work until there is an answer available.

Qt - How to open a website in a particular browser

I am coding one project, which needs to launch some webbrowsers with the given url.
I saw some QT examples, but they explained how to launch the default browser, not a particular browser.
Any helping suggestions will be appreciated.
Edit1:
Below is the code I use currently
QString temp="C:/Program Files/Internet Explorer/iexplore.exe";
process->start(temp.toStdString().c_str());
Edit2
Hi, I found that the problem is not in QProcess->start, Because it works perfectly for "explorer.exe", But not works, for executables which are in Program Files.
So I post a new question about it.
If you know which browser you want to start and where they are located on the system (such as the default installation directories). You should be able to use QProcess
This can usually be done as the following:
iexplore.exe http://www.locationOfUrl.com
or
//path/to/app/firefox.exe http://www.locationOfUrl.com
system("/path/to/the/browser \"http://www.the.com/url\"");
or spawn instead of system (gives you control over environment variables, etc.)

Strange QT application behavior

I'm developing a QT application with QTCreator (and QT 4.5.3) on Arch Linux. I'm using KDE 4.3
The project is basically a GUI that let you insert a url and make some web requests to give the user some data back.
The web requests are asynchronous.
I've encountered a weird problem.
If I start the application the first time and click on the button that launches the web requests, it crashes.
On the second time it works as expected.
The third and the fourth time it returns just one of the 900 values I was expecting.
What's strange is that on Windows (and QT 4.6) is working always fine..
Have you ever seen such a thing?
Thanks in advance for your information
Best regards
I've never seen anything exactly like this, but I have seen different behaviours between Linux and Windows where the Windows code seemed to work. In my experience, the code is almost always wrong - it's just much easier to catch it when you run in Linux.
I have two suggestions to make:
run with Valgrind: this will catch the obvious flaws
link with the Qt debug libs (usually QtCored.so, QtGuid.so on Linux)
And a third: look very carefully at the web requests responses in Linux / Windows, possibly in a diff-scanner. Any differences might point you in the right direction
I'd say that has something to do with cookies.
Try to create the smallest possible application that reproduces that bug and then try to determine, if it's your or Trolltech's code that crashes.
The problem was related to an array of elements which weren't set in time