Why is the Qt Creator Ubuntu Publish Screen Empty? - c++

I'm trying to publish an app to the Ubuntu Store, however something is wrong with Qt Creator (or something else).
I used to be able to see this:
But now all I see is this:
As you can see (or read, if you're using a Reader with no images), the second image here isn't displaying things like the General tab which allows me to enter details such as Maintainer, Name, Description, Security Policy Groups - it doesn't have a Manifest tab AppArmor tab or Excludes tab either. The Create Package button is gone.
All I am left with is a blank screen with only 1 enabled button which reads 'Validate existing Click package', but when I click that (since there's nothing else I can do, it seems...), it takes me to my Projects directory where all my apps are listed. I select the app in question, and I can't click the open button on the dialog because there is no *.click file anywhere to be seen.
Have I done something wrong? Do you know what's going on here?
Also, I read that in order to publish to the store, we need to create "Click apps". I've searched the universe for this phrase and have come up empty handed. How do I create a "Click app"? I thought the app I was creating was a click app (I went to Qt Creator > Qt Quick Application > ...).
Links:
Tutorial for Publishing apps: http://developer.ubuntu.com/publish/apps/packaging-click-apps/

The reason is that you are using QtCreator from Qt Project proper instead of using the Ubuntu SDK, which delivers its own custom version of QtCreator.
In order to get things done for this, you will need to use the Ubuntu SDK. First you need to install it:
$ sudo add-apt-repository ppa:ubuntu-sdk-team/ppa
$ sudo apt-get update && sudo apt-get install ubuntu-sdk
This will also install the qtcreator-plugin-ubuntu package, its own toolchain, etc. Then you can run it e.g. from the command line as follows:
$ ubuntu-sdk
You can also search in the Unity Dash Applications lens for “Ubuntu SDK” as the image shows below:
You can also just start typing the name in the search line as the images shows below:
Please make sure that you go to the following:
New Project > Ubuntu > Simple UI/Html/QML/etc
rather than e.g. what you tried based on your question:
New Project > Qt Quick Application
You may also with to set up the click targets and device kits part of which (Build and Run) is presented below inline:

First of all you need to read this well , luckily i have been developing ubuntu HTML5 apps recently , so i have been in your place before , you will be able to integrate your c++ code using the QML option ( as ubuntu developers have only 2 options either HTML5 or QML ).
Here is a sample project found on xda to create a simple calculator app ( pay attention how to include your cpp file ):
File Name:apcalc-qml.pro
QT += qml quick
# If your application uses the Qt Mobility libraries, uncomment the following
# lines and add the respective components to the MOBILITY variable.
# CONFIG += mobility
# MOBILITY +=
#C++ source files
SOURCES += cpp/main.cpp\
cpp/applicationdata.cpp\
#C++ header files
HEADERS += cpp/applicationdata.h
#Path to the libraries...
INCLUDEPATH += $$PWD\
$$PWD/../../../../usr/lib
DEPENDPATH += $$PWD/../../../../usr/lib
#Path to "other files" in this case the QML-Files
OTHER_FILES += \
qml/main.qml\
qml/basicCalc/*.qml
File Name:main.cpp
#include <QtGui/QGuiApplication>
#include <QGuiApplication>
#include <QQuickView>
#include <QtQml/qqmlcontext.h>
#include <stdio.h>
#include "applicationdata.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView view;
ApplicationData data;
//Resize Mode so the content of the QML file will scale to the window size
view.setResizeMode(QQuickView::SizeRootObjectToView);
//With this we can add the c++ Object to the QML file
view.rootContext()->setContextProperty("applicationData", &data);
//Resolve the relativ path to the absolute path (at runtime)
const QString qmlFilePath= QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), "qml/main.qml");
view.setSource(QUrl::fromLocalFile(qmlFilePath));
//For debugging we print out the location of the qml file
QByteArray ba = qmlFilePath.toLocal8Bit();
const char *str = ba.data();
printf("Qml File:%s\n",str);
//Not sure if this is nessesary, but on mobile devices the app should start in fullscreen mode
#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
view.showFullScreen();
#else
view.show();
#endif
return app.exec();
}
File Name:main.qml
import QtQuick 2.0
import Ubuntu.Components 0.1
import "basicCalc"
import QtQuick.Window 2.0
MainView {
//objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
applicationName: "apcalc-qml"
automaticOrientation:true;
width: units.gu(60);
height: units.gu(100);
id:root
Tabs {
objectName: "Tabs"
ItemStyle.class: "new-tabs"
anchors.fill: parent
id:mainWindow;
Tab {
objectName: "Calculator"
title: "Calculator"
page:BasicCalc{
width: root.width;
height: root.height-root.header.height;
anchors.top: parent.top;
anchors.topMargin: root.header.height;
onToCalculateChanged: {
//access to the c++ Object
result=applicationData.calculate(toCalculate);
}
}
}
}
}
File Name:applicationdata.h
#ifndef APPLICATIONDATA_H
#define APPLICATIONDATA_H
#include <QObject>
class ApplicationData : public QObject
{
Q_OBJECT
public:
explicit ApplicationData(QObject *parent = 0);
Q_INVOKABLE QString calculate(QString) const;
signals:
public slots:
};
#endif // APPLICATIONDATA_H
File Name:applicationdata.cpp
#include "applicationdata.h"
ApplicationData::ApplicationData(QObject *parent) :
QObject(parent)
{
}
QString ApplicationData::calculate(QString command) const {
// Some Logic comes here
return command;
}
You can check the full tutorial here , though this app is intended to work for ubuntu touch but i believe that all QML projects follow the same procedure.
Publishing App :
First of all click App means a package , a one file click > installs your app AKA (Personal Package Archives (PPA) ) , in order to publish your app , you need to follow some procedure metioned in details here , eventhough the xda tutorial explains everything in a clear way.

Related

Invisible text in QTextEdit

I am learning Qt and running examples from Qt SDK 5.9.1. I run the code below and write inside QTextEdit but no text appears. Cursor moves as I write but no text is shown. Window title text is shown. I added addApplicationFont and setFont calls below I found from web to the sample but it didn't help.
#include <QtWidgets>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QFontDatabase::addApplicationFont("://Ubuntu-R.ttf");
app.setFont(QFont("Ubuntu", 11, QFont::Normal, false));
QTextEdit textEdit;
textEdit.show();
return app.exec();
}
I am on Ubuntu 16.04 and run following commands on bash to make executable:
qmake -makefile
make
./part1
I want the app to use the default Ubuntu system font. I learned that Qt uses fontconfig for fonts but I don't know how to trace the issue.
Edit
I thought QFontDatabase::addApplicationFont("://Ubuntu-R.ttf") call referenced system font but instead it is referencing font app resource file. I don't have resource file so obviously it won't work.
.pro file is below(unmodified sample file):
QT += widgets
SOURCES = main.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/gettingStarted/gsQt/part1
INSTALLS += target
I tried to get system font using QFontDatabase but it didn't work:
app.setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont));
This doesn't do anything with any of enum values including QFontDatabase::GeneralFont
QFontDatabase database;
QStringList fam = database.families();
fam size is zero.
I will try to use embedded font next.
I don't know the exact reason of the problem but the reason was not configuring fontconfig dependency properly before building qt. I solved it by reconfiguring and recompiling qt again. You can find more details at qt forum.

How do I set my application version for Windows in Qt?

When my application crashes, the Windows Event Viewer always reports my application version as "0.0.0.0".
I can't figure how to set the application version in a way that the Windows Event Viewer recognizes. Changing it with QApplication::setApplicationVersion() doesn't seem to do it.
Obviously there are better ways to debug a program than the Windows Crash Log, but in lieu of all of that, how would I go about setting this value so that Windows recognizes it? My IDE is Qt Creator.
You can set the VERSION qmake variable in your pro file:
VERSION = 1.0.0.0
On Windows, triggers auto-generation of an .rc file if the RC_FILE and
RES_FILE variables are not set. The generated .rc file will have the
FILEVERSION and PRODUCTVERSION entries filled with major, minor, patch
level, and build number.
Use the QCoreApplication class.
QCoreApplication::setApplicationVersion("1.0");
If you develop a widget app or qml, maybe you want to show your version in WindowTitle full solution would be:
In .pro file add:
VERSION = 1.2.3
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
and in QWdiget or QMainWindow
setWindowTitle("Qt " +qtVersion + " Version"+ APP_VERSION);
or in QML
ApplicationWindow {
title: "Qt " +qtVersion + " Version"+ APP_VERSION
...

Why are my qt file dialogs rendered incorrectly?

I'm currently creating a GUI with Qt 5.6 and I want to let the user open a file. I do this using the following code in my main window class:
#include <QFileDialog>
...
void MainWindow::loadScene()
{
QString loadPath = QFileDialog::getOpenFileName(this,
tr("Choose a scene file"), QString("."),
tr("Scene files (*.keyScene)"));
if(!loadPath.isEmpty())
resourceManager->loadScene(loadPath.toStdString());
}
I get the following dialog:
Screenshot of open file dialog
The system I use is Ubuntu 16.04, I've also tested on Ubuntu 14.04 and Mint 17.3. I get the exact same result on all of them.
When I compile the project in Windows everything works fine.
EDIT
It was suggested I play around with the DontUseNativeDialog flag when creating a file dialog, I can get a working Qt style file dialog with the following code:
QFileDialog dialog(this);
dialog.setAcceptMode(QFileDialog::AcceptOpen);
dialog.setOption(QFileDialog::Option::DontUseNativeDialog, true);
if(!dialog.exec())
return;
So the question is actually why native file dialogs aren't rendered correctly.

Add Settings entry for iOS app using Qt 5.4

I have built an iOS 8.2 app using Qt 5.4. I want to add a user-entry field in the Settings app like a lot of other apps do, but I can't figure out how to do it. I tried the following (which doesn't work):
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
TDA::TapDisplaySingleton* mainClass =
new TDA::TapDisplaySingleton(&app);
QObject::connect(&app, SIGNAL(aboutToQuit()),
mainClass, SLOT(aboutToQuitApp()));
QGuiApplication::setOrganizationName("NASA Langley");
QGuiApplication::setOrganizationDomain("larc.nasa.gov");
QGuiApplication::setApplicationName("TAP Display");
QSettings settings;
settings.setValue("HOSTNAME", "localhost");
QTimer::singleShot(10, mainClass, SLOT(run()));
return app.exec();
}
When I fire the app up in the Simulator and open the Settings app, my entry does not appear. Does anyone know how to do this effectively in iOS using Qt?
As it turns out, Qt does provide a way to generate a Settings.bundle file for your app. You need to define a Root.plist and Root.strings file in advance and then add the following to your .PRO file:
SETTINGS_BUNDLE_DATA_ROOT.files += Root.plist
SETTINGS_BUNDLE_DATA_ROOT.path = Settings.bundle
SETTINGS_BUNDLE_DATA_LANG.files += Root.strings
SETTINGS_BUNDLE_DATA_LANG.path = Settings.bundle/en.lproj
QMAKE_BUNDLE_DATA += SETTINGS_BUNDLE_DATA_ROOT SETTINGS_BUNDLE_DATA_LANG
When your project is linked, the bundle will be created.
QSettings is only for storing settings in a persistent fashion. Adding settings to the iOS Settings application is outside of the scope of Qt. Look up "iOS Settings Bundle" for information on how to create those - eg https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html .

Qt5 WebKit not detecting NPAPI plugin

#include "mainwindow.h"
#include <QApplication>
#include <QtWebKit>
#include <QWebView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebView *view = new QWebView();
QWebSettings::PluginsEnabled;
view->load(QUrl("http://www.paulirish.com/demo/multi"));
view->show();
return a.exec();
}
I am trying to load a plugin in QtWebkit Webview but it isnt being loaded. I couldnt find the right path as mentioned Here, but it isnt loading. I have added Env. Variable QTWEBKIT_PLUGIN_PATH to System Variable & MOZ_PLUGIN_PATH was already in user variable, added by Foxit Reader. I tried placing the plugin dll file on both the directories corresponding to the Env. Variables but it isnt loading the plugin. After i palced the plugin in Moz_plugin_path, firefox was able to detect the plugin.
As for enabling the plugin in QTWebview i have tried using
QWebSettings::PluginsEnabled;
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled,true);
view->page()->settings()->PluginsEnabled;
but found success with none of them, I am using Windows 8.1 and Qt 5.2
You should set the QWebSettings::PluginsEnabled attribute. The way you are doing it, nothing is happening.
Enable the attribute with the following code:
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
Put this before your QWebView creation.
Refer to the documentation for more details:
QWebSettings Docs
i have been through exactly the same situation. what solved my problem was to install adobe flash player plugin for NPAPI. Modern web browsers like Google Chrome and Firefox are often distributed with builtin flash player plugin. So Chrome/Firefox works well does not ensure that you have the proper flash plugin installed properly systemwide, which is needed by Qt5WebKit to enable local plugin support for Flash content.
so, make sure the adobe flash player plugin for NPAPI is installed, and hope it would solve your problem.