LRESULT CServerListView::OnNmClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { TVHITTESTINFO ht = {0}; DWORD dwpos = GetMessagePos(); ht.pt.x = GET_X_LPARAM(dwpos); ht.pt.y = GET_Y_LPARAM(dwpos); // TODO: check ok on multi-monitor system // TODO: use ClientToScreen() instead ::MapWindowPoints(HWND_DESKTOP, pnmh->hwndFrom, &ht.pt, 1); m_tree.HitTest(&ht); //TreeView_HitTest(pnmh->hwndFrom, &ht); if(TVHT_ONITEM & ht.flags) { OnItemClicked(ht.hItem); } else { bHandled = FALSE; } return 0; }
void AppStorePageWidget::loadProperties(QList<Webbox::Data::CommonProperty*> propertyList) { for (int i = 0; i < 4; ++i) { for (int j = 0; j < 3; ++j) { if (app_content_arr[i][j] != NULL) { grid_widget->removeItem(app_content_arr[i][j]); app_content_arr[i][j] = NULL; } } } stacked_widget->removeWidget(scrollArea); stacked_widget->removeWidget(grid_widget); delete grid_widget; grid_widget = NULL; grid_widget = new GridContentWidget(APP_CONTENT_ROW, APP_CONTENT_COL); int idx = 0; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 3; ++j) { if (propertyList.count()>idx) { AppletWidget *widget = new AppletWidget(209, 90, false, propertyList[idx++]); connect(widget, SIGNAL(labelPress()), this, SLOT(OnItemClicked())); grid_widget->addItem(widget); app_content_arr[i][j] = widget; } } } stacked_widget->addWidget(grid_widget); update(); }
ItemButton::ItemButton(QWidget *parent) : QPushButton(parent), m_nItemValue(-1) { connect(this, SIGNAL(clicked()), this, SLOT(OnItemClicked())); }