ZLQtToolButton::ZLQtToolButton(ZLQtApplicationWindow &window, ZLToolbar::AbstractButtonItem &item) : QToolButton(window.myToolBar), myWindow(window), myItem(item) { static std::string imagePrefix = ZLibrary::ApplicationImageDirectory() + ZLibrary::FileNameDelimiter; QPixmap icon((imagePrefix + myItem.iconName() + ".png").c_str()); setIconSet(QIconSet(icon)); QSize size = icon.size(); QIconSet::setIconSize(QIconSet::Large, size); QIconSet::setIconSize(QIconSet::Small, size); if (item.type() == ZLToolbar::Item::TOGGLE_BUTTON) { setToggleButton(true); } else if (item.type() == ZLToolbar::Item::MENU_BUTTON) { ZLToolbar::MenuButtonItem &menuButtonItem = (ZLToolbar::MenuButtonItem&)myItem; shared_ptr<ZLPopupData> popupData = menuButtonItem.popupData(); myWindow.myPopupIdMap[&menuButtonItem] = !popupData ? (size_t)-1 : (popupData->id() - 1); setPopup(new ZLQtPopupMenu(this)); } QString text = QString::fromUtf8(myItem.tooltip().c_str()); setTextLabel(text); setUsesTextLabel(false); QToolTip::add(this, text); connect(this, SIGNAL(clicked()), this, SLOT(onActivated())); }
void setTextInputBox(entity me, string txt) { if(me.text) strunzone(me.text); setTextLabel(me, strzone(txt)); }