[code] more debugging for touchscreen detection

This commit is contained in:
Huan Truong 2018-03-31 02:08:45 -04:00
parent 099f14d3de
commit eed0c9b35b
2 changed files with 9 additions and 0 deletions

View File

@ -160,8 +160,16 @@ void Configuration::save()
bool Configuration::hasTouchScreen() const
{
auto touchdevs = QTouchDevice::devices();
OPENAUTO_LOG(info) << "[Touchdev] " <<
"Querying available touch devices [" <<
touchdevs.length() << " available]";
for (int i = 0; i < touchdevs.length(); i++) {
if (touchdevs[i]->type() == QTouchDevice::TouchScreen) {
OPENAUTO_LOG(info) << "[Touchdev] Device " << i <<
": " << touchdevs[i]->name().toStdString() <<
", type " << touchdevs[i]->type();
return true;
}
}

View File

@ -105,6 +105,7 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec);
if (configuration->hasTouchScreen()) {
OPENAUTO_LOG(info) << "[Touchdev] Hiding mouse cursor due to detection of a touch device";
qApplication.setOverrideCursor(Qt::BlankCursor);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {
const auto cursor = qApplication.overrideCursor()->shape() == Qt::BlankCursor ? Qt::ArrowCursor : Qt::BlankCursor;