← Back to team overview

ubuntu-phone team mailing list archive

Re: Running uNav locally

 


On 21.04.2016 15:49, Matthias Apitz wrote:
> El jueves, 21 de abril de 2016 15:12:37 (CEST), Michael Zanetti
> <michael.zanetti@xxxxxxxxxxxxx> escribió:
>>
>>
>>  
>> Note that you are tricking the system into thinking you are launching
>> the dialer-app with this. While your "fake dialer app" is running, you
>> probably won't be able to properly handle phone calls as the real dialer
>> app can't be started. Better create your own .desktop file for your app.
>>
>>
> Yes, thanks for the hint.
> 
> At the moment I cant let it do anything with the attached code
> it starts, but crashes with SIGSEGV
> 

You need to paint a view before you can show a button. You could create
a QMainWindow and add the QPushButton in there I suppose, but I'd
strongly recommend to not use QWidget, but instead QML.

As a quick start start:

main.cpp:

#include <QQuickView>
#include <QCoreApplication>

int main(int argc, char *argv[]) {
  QGuiApplication app(argc, argv);
  QQuickView v;
  v.setSource("/path/to/some/qmlfile.qml");
  v.show();
  return app.exec();
}

/path/to/some/qmlfile.qml:

import QtQuick 2.4
import Ubuntu.Components 1.3

MainView {
  Button {
    anchors.centerIn: parent
    text: "click me"
    onClicked: print("button clicked")
  }
}

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References