2014-09-20 2 views
2

Qt를 사용하여 Android 위젯을 만들 수 있습니까?Qt의 Android 위젯

내 프로그램은 디지털 시계 (hh/mm/ss)와 날짜가 포함 된 시간을 표시하며 안드로이드 응용 프로그램으로 안드로이드에서 작동합니다.

이 프로그램을 편집하여 Android 위젯을 만들려고합니다. 어떤 생각입니까?

mainwindow.cpp 것은

#include "mainwindow.h" 
#include "ui_mainwindow.h" 
#include <QTimer> 
#include <QTime> 
#include "dialog.h" 

MainWindow::MainWindow(QWidget *parent) : 
    QMainWindow(parent), 
    ui(new Ui::MainWindow) 
{ 
    ui->setupUi(this); 
    //showTime(); 
    QTimer *timer = new QTimer(this); 
    connect(timer , SIGNAL(timeout()), this , SLOT(showTime())); 
    timer->start(); 

    QDateTime dateTime =QDateTime::currentDateTime(); 
    QString datetimetext = dateTime.toString(); 
    ui->DateTime->setText(datetimetext); 

} 
void MainWindow::showTime(){ 
    QTime time = QTime::currentTime(); 
    QString time_text = time.toString("hh : mm : ss"); 
    if((time.second()%2)==0){ 
     time_text[3]=' '; 
     time_text[8]=' '; 

    } 
    ui->Digital_clock->setText(time_text); 
} 

MainWindow::~MainWindow() 
{ 
    delete ui; 
} 

void MainWindow::on_pushButton_clicked() 
{ 
    Dialog secdialog; 
    secdialog.setModal(true); 
    secdialog.exec(); 
} 
+0

당신은 C++로 코딩 된 일반적인 qt 위젯을 만들 수 있습니다. 그리고 나서 안드로이드로 이식 할 수 있습니다. – West1234

+0

[this] (https://forum.qt.io/topic/46175/how-create-android-widget-on-qt) –

+0

qtcreator와 함께 android ndk를 사용할 수 있습니다. 귀하의 전화 또는 가상 장치가 가지고있는 아키텍처에 상관없이 완벽하게 C++ 코드를 컴파일 할 수 있습니다 ... 읽으십시오 : http://doc.qt.io/qt-5/androidgs.html – kainlite

답변

2

이 모든 질문에 답이 남아 있기 때문에, 나는이 일을 답변 해 드리겠습니다. Android 위젯은 현재 Qt 프레임 워크 (Phonegap과 같은 다른 크로스 플랫폼 기술)를 사용하여 수행 할 수 없습니다. 순수한 원시 Java 응용 프로그램이어야합니다.

+0

답변 해 주셔서 감사합니다. –