// --------------------------------------------------------------------- void DateEdit::set(string p,string v) { QDateEdit *w=(QDateEdit*) widget; QString cmd=s2q(p); QStringList arg=qsplit(v); if (arg.isEmpty()) { Child::set(p,v); return; } int i,y,m,d; if (cmd=="format") { w->setDisplayFormat(s2q(remquotes(v))); } else if (cmd=="min") { i=c_strtoi(q2s(arg.at(0))); toymd(i, &y, &m, &d); w->setMinimumDate(QDate(y,m,d)); } else if (cmd=="max") { i=c_strtoi(q2s(arg.at(0))); toymd(i, &y, &m, &d); w->setMaximumDate(QDate(y,m,d)); } else if (p=="readonly") { w->setReadOnly(remquotes(v)!="0"); } else if (cmd=="value") { // TODO actually null date does not work because of input mask i=c_strtoi(q2s(arg.at(0))); if (i) { toymd(i, &y, &m, &d); w->setDate(QDate(y,m,d)); } else w->setDate(QDate()); } else Child::set(p,v); }
// --------------------------------------------------------------------- string smopen() { string c=cmd.getid(); string p=cmd.getparms(); if (c=="edit") term->vieweditor(); if (c=="edit2") { if (note==0) return smerror("no edit window open"); note->on_winotherAct_triggered(); } if (c=="edit" || c=="edit2") return ""; if (c!="tab") { return smerror("unrecognized sm command: open " + c); } term->vieweditor(); if (p.empty()) note->newtemp(); else { QString f=s2q(smgetscript(p)); if (!cfexist(f)) return smerror("file not found: " + q2s(f)); note->fileopen(f); } rc=-1; return i2s(note->editIndex()); }
// --------------------------------------------------------------------- string smsetinputlog(string c,string q) { if (c!="text") return smerror("unrecognized sm command: set inputlog " + c + "..." ); dlog_set(s2q(q)); return ""; }
// --------------------------------------------------------------------- ProgressBar::ProgressBar(string n, string s, Form *f, Pane *p) : Child(n,s,f,p) { type="progressbar"; QProgressBar *w=new QProgressBar; widget=(QWidget*) w; QString qn=s2q(n); QStringList opt=qsplit(s); if (invalidoptn(n,opt,"")) return; w->setObjectName(qn); childStyle(opt); int i=0; if ((i<opt.size()) && (opt.at(i)=="v")) { i++; w->setOrientation(Qt::Vertical); } if (i<opt.size()) { w->setMinimum(c_strtoi(q2s(opt.at(i)))); i++; } if (i<opt.size()) { w->setMaximum(c_strtoi(q2s(opt.at(i)))); i++; } if (i<opt.size()) { w->setValue(c_strtoi(q2s(opt.at(i)))); i++; } }
//获取上传节点 //输入: consumerKey consumerSecret oauthToken oauthTokenSecret //输出:uploadNode //返回: http 状态 extern "C" __declspec(dllexport) int kpUploadLocate(string &uploadNode,\ const string &consumerKey,const string &consumerSecret,\ const string &oauthToken,const string &oauthTokenSecret ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mAuTokenInfo.auToken=s2q(oauthToken); kp->mAuTokenInfo.auTokenSecret=s2q(oauthTokenSecret); kp->reqUploadLocate(); uploadNode=q2s(kp->mUploadNode); int ret=kp->mRet; delete kp; return ret; }
// --------------------------------------------------------------------- SpinBox::SpinBox(string n, string s, Form *f, Pane *p) : Child(n,s,f,p) { type="spinbox"; QSpinBox *w=new QSpinBox; QString qn=s2q(n); widget=(QWidget*) w; QStringList opt=qsplit(s); if (invalidoptn(n,opt,"")) return; w->setObjectName(qn); childStyle(opt); w->setLocale(QLocale::C); int i=0; if (i<opt.size()) { w->setMinimum(c_strtoi(q2s(opt.at(i)))); i++; } if (i<opt.size()) { w->setSingleStep(c_strtoi(q2s(opt.at(i)))); i++; } if (i<opt.size()) { w->setMaximum(c_strtoi(q2s(opt.at(i)))); i++; } if (i<opt.size()) { w->setValue(c_strtoi(q2s(opt.at(i)))); i++; } connect(w,SIGNAL(valueChanged(int)), this,SLOT(valueChanged())); }
// --------------------------------------------------------------------- ToolBar::ToolBar(string n, string s, Form *f, Pane *p) : Child(n,s,f,p) { type="toolbar"; QToolBar *w=new QToolBar; widget=(QWidget*) w; QString qn=s2q(n); QStringList opt=qsplit(s); if (invalidoptn(n,opt,"vertical")) return; w->setObjectName(qn); childStyle(opt); if (opt.contains("vertical")) w->setOrientation(Qt::Vertical); if (opt.size()) { QString t=opt.at(0); if (qshasonly(t,"0123456789x")) { QStringList sizes=t.split('x'); if (sizes.size()<2) { error("invalid icon width, height: " + q2s(t)); return; } w->setIconSize(QSize(c_strtoi(q2s(sizes.at(0))),c_strtoi(q2s(sizes.at(1))))); } } connect(w,SIGNAL(actionTriggered(QAction *)), this,SLOT(actionTriggered(QAction *))); }
//获取临时token、secret和认证url //输入:consumerKey consumerSecret //输出:tmpOauthToken tmpOauthTokenSecret authoriseUrl //返回: http 状态 //通过 consumer_key consumer_secret使用requestToken得到oauth_token oauth_token_secret extern "C" __declspec(dllexport) int kpReqTmpToken(string &tmpOauthToken,string &tmpOauthTokenSecret,\ string &authoriseUrl,\ const string &consumerKey,const string &consumerSecret) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->reqReqTmpToken(); tmpOauthToken=q2s(kp->mTmpToken); tmpOauthTokenSecret=q2s(kp->mTmpTokenSecret); authoriseUrl=q2s(QString(KP_AUTHORISE_SRC_URL).append(s2q(tmpOauthToken))); int ret=kp->mRet; delete kp; return ret; }
// --------------------------------------------------------------------- int Menus::menupop(string c) { QString s=s2q(c); if (curMenu==0) { curMenu=((QMenuBar*) widget)->addMenu(s); connect(curMenu,SIGNAL(triggered(QAction *)), this,SLOT(menu_triggered(QAction *))); } else
// --------------------------------------------------------------------- void Form::setpicon(string p) { int spi; if (p.substr(0,8)=="qstyle::" && -1!=(spi=wdstandardicon(p))) setWindowIcon(this->style()->standardIcon((QStyle::StandardPixmap)spi)); else setWindowIcon(QIcon(s2q(p))); }
//分享文件 //输入: consumerKey consumerSecret oauthToken oauthTokenSecret 、 // isAppPath fromPath //输出:jsonShareFile //返回: http 状态 extern "C" __declspec(dllexport) int kpShareFile(string &jsonShareFile, const string &consumerKey,const string &consumerSecret,\ const string &oauthToken,const string &oauthTokenSecret,\ const bool &isAppPath,const string &fromPath ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mAuTokenInfo.auToken=s2q(oauthToken); kp->mAuTokenInfo.auTokenSecret=s2q(oauthTokenSecret); kp->mIsAppPath=isAppPath; kp->mFromPath=s2q(fromPath); kp->reqShareFile(); jsonShareFile=q2s(kp->mJsonBuf); int ret=kp->mRet; delete kp; return ret; }
//获取文件(夹)信息 //输入: consumerKey consumerSecret oauthToken oauthTokenSecret isAppPath dataPath //isAppPath 若应用访问权限路径为kuaipan则为false,否为true //dataPath 是指要获取的文件(夹)路径+名 //输出:jsonMetaData //返回: http 状态 extern "C" __declspec(dllexport) int kpMetaData(string &jsonMetaData,\ const string &consumerKey,const string &consumerSecret,\ const string &oauthToken,const string &oauthTokenSecret, const bool &isAppPath, const string &dataPath ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mAuTokenInfo.auToken=s2q(oauthToken); kp->mAuTokenInfo.auTokenSecret=s2q(oauthTokenSecret); kp->mIsAppPath=isAppPath; kp->mDataPath=s2q(dataPath); kp->reqMetaData(); jsonMetaData=q2s(QString(kp->mJsonBuf)); int ret=kp->mRet; delete kp; return ret; }
//新建文件夹 //输入: consumerKey consumerSecret oauthToken oauthTokenSecret isAppPath floderPath //isAppPath 若应用访问权限路径为kuaipan则为false,否为true //floderPath 是指要新建的文件夹路径+名 //输出:jsonCreateFolder //返回: http 状态 extern "C" __declspec(dllexport) int kpCreateFolder(string &jsonCreateFolder,\ const string &consumerKey,const string &consumerSecret,\ const string &oauthToken,const string &oauthTokenSecret, const bool &isAppPath, const string &floderPath ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mAuTokenInfo.auToken=s2q(oauthToken); kp->mAuTokenInfo.auTokenSecret=s2q(oauthTokenSecret); kp->mIsAppPath=isAppPath; kp->mCreateFolderPath=s2q(floderPath); kp->reqCreateFloder(); jsonCreateFolder=q2s(QString(kp->mJsonBuf)); int ret=kp->mRet; delete kp; return ret; }
// --------------------------------------------------------------------- string smsettext(string p,string s) { QString t=s2q(s); if (p=="term") tedit->setPlainText(t); else if (p=="edit") note->settext(t); else note2->settext(t); return""; }
void tnotesbookDelegate::paint(QPainter*painter,const QStyleOptionViewItem&option, const QModelIndex&index)const { QStyleOptionViewItem myOption=option; QFont qf(s2q("微软雅黑")); QFont qfNormal(s2q("微软雅黑")); qf.setPixelSize(14); qf.setBold(true); QString content = index.model()->data(index, Qt::DisplayRole).toString(); // 取到模型中原来的内容 QString qstrName=content; QString qstrDate=s2q("2014/3/14"); QString qstrContent=s2q("1我2我3我4我5我6我我7我8我9我我10我我11我我12我我13我我14我我15我我16我我我17我我我我我我我我我我我我我1我2我3我4我5我6我我7我8我9我我10我我11我我1我2我3我4我5我6我我7我8我9我我10我我11我我"); QRect drawRectTextName=QRect(option.rect.topLeft(), QSize(option.rect.size().width()/2,option.rect.size().height()/4)); QRect drawRectTextDate=QRect(option.rect.topLeft()+QPoint(option.rect.size().width()/2,0), QSize(option.rect.size().width()/2,option.rect.size().height()/4)); QRect drawRectTextContent=QRect(option.rect.topLeft()+QPoint(0,option.rect.size().height()/4), QSize(option.rect.size().width(),option.rect.size().height()*3/4)); QTextOption qto; painter->setFont(qf); painter->setPen(QColor(23,48,5)); painter->drawText(drawRectTextName, qstrName); painter->setFont(qfNormal); painter->setPen(Qt::darkGreen); painter->drawText(drawRectTextDate, qstrDate); painter->setFont(qfNormal); painter->setPen(Qt::black); painter->drawText(drawRectTextContent, qstrContent); painter->setPen(Qt::darkGreen); painter->drawLine(option.rect.bottomLeft(),option.rect.bottomRight()); myOption.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; // 处理文本的对齐方式 (不重要) drawFocus(painter,option,option.rect); }
// --------------------------------------------------------------------- int wdclipwriteimage(char *s) { QClipboard *clipboard = app->clipboard(); if (!clipboard) return 1; if (!s || !strlen(s)) clipboard->clear(); else { QImage image(s2q(s)); if (image.isNull()) return 1; clipboard->setImage(image); } return 0; }
// --------------------------------------------------------------------- void Form::set(string p,string v) { if (p=="enable") { setEnabled(remquotes(v)!="0"); } else if (p=="font") { setFont((Font(v)).font); } else if (p=="invalid") { update(); } else if (p=="show"||p=="visible") { setVisible(remquotes(v)!="0"); } else if (p=="stylesheet") { setStyleSheet(s2q(remquotes(v))); } else if (p=="taborder") { settaborder(v); } else if (p=="tooltip") { setToolTip(s2q(remquotes(v))); } else if (p=="wh") { wdsetwh(this,v); } else error("set command not recognized: " + p + " " + v); }
//获取用户信息 //输入: consumerKey consumerSecret oauthToken oauthTokenSecret //输出:max_file_size user_name quota_used quota_total //返回: http 状态 extern "C" __declspec(dllexport) int kpUsrInfo(string &max_file_size, string &user_name,\ string "a_used, string "a_total,\ const string &consumerKey,const string &consumerSecret,\ const string &oauthToken,const string &oauthTokenSecret ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mAuTokenInfo.auToken=s2q(oauthToken); kp->mAuTokenInfo.auTokenSecret=s2q(oauthTokenSecret); kp->reqUsrInfo(); max_file_size=q2s(kp->mUsrInfo.maxFileSize); user_name=q2s(kp->mUsrInfo.usrName); quota_used=q2s(kp->mUsrInfo.quotaUsed); quota_total=q2s(kp->mUsrInfo.quotaTotal); int ret=kp->mRet; delete kp; return ret; }
//获取accessToken //输入:consumerKey consumerSecret tmpOauthToken tmpOauthTokenSecret //输出:oauthToken oauthTokenSecret usrID chargedDir //返回: http 状态 extern "C" __declspec(dllexport) int kpAccessToken(string &oauth_token, string &oauth_token_secret,\ string &user_id, string &charged_dir,\ const string &consumerKey,const string &consumerSecret,\ const string &tmpOauthToken,const string &tmpOauthTokenSecret ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mTmpToken=s2q(tmpOauthToken); kp->mTmpTokenSecret=s2q(tmpOauthTokenSecret); kp->reqAcessToken(); oauth_token=q2s(kp->mAuTokenInfo.auToken); oauth_token_secret=q2s(kp->mAuTokenInfo.auTokenSecret); user_id=q2s(kp->mAuTokenInfo.usrID); charged_dir=q2s(kp->mAuTokenInfo.chargedDir); int ret=kp->mRet; delete kp; return ret; }
//删除文件夹 //输入: consumerKey consumerSecret oauthToken oauthTokenSecret isAppPath floderPath to_recycle //isAppPath 若应用访问权限路径为kuaipan则为false,否为true //floderPath 是指要获取的文件(夹)路径+名 //to_recycle 是否删除到回收站? //输出:jsonDelFile extern "C" __declspec(dllexport) int kpDelFile(string &jsonDelFile,\ const string &consumerKey,const string &consumerSecret,\ const string &oauthToken,const string &oauthTokenSecret, const bool &isAppPath, const string &floderPath, const bool &to_recycle ) { kpSDK *kp=new kpSDK(); kp->mConsumerKey=s2q(consumerKey); kp->mConsumerSecret=s2q(consumerSecret); kp->mAuTokenInfo.auToken=s2q(oauthToken); kp->mAuTokenInfo.auTokenSecret=s2q(oauthTokenSecret); kp->mIsAppPath=isAppPath; kp->mIsToRecyle=to_recycle; kp->mDelFilePath=s2q(floderPath); kp->reqDelFile(); jsonDelFile=q2s(QString(kp->mJsonBuf)); int ret=kp->mRet; delete kp; return ret; }
// --------------------------------------------------------------------- QAction *Menus::makeact(string id, string p) { QStringList s=qsplit(p); QString text=s.value(0); QString shortcut=s.value(1); QAction *r = new QAction(text,widget); QString name=s2q(id); r->setObjectName(name); r->setMenuRole(QAction::NoRole); if (shortcut.size()) r->setShortcut(shortcut); items[name]=r; return r; }
// ------------------------------------------------------------------- Table::Table(string n, string s, Form *f, Pane *p) : Child(n,s,f,p) { type="table"; initglobals(); ifhdr=false; rws=cls=len=0; row1=col1=0; row2=col2=-1; markrow=markcol=0; dblclick=QDateTime::currentDateTime(); QTableWidgex *w=new QTableWidgex(this); widget=(QWidget*) w; w->setObjectName(s2q(n)); QStringList opt=qsplit(s); if (invalidoptn(n,opt,"selectrows sortable")) return; QStringList shape; if (opt.size()>=2) { if ((isint(q2s(opt.at(0)))) && ((isint(q2s(opt.at(1)))))) { shape=qsplit((q2s(opt.at(0)))+" "+(q2s(opt.at(1)))); setshape(shape); } } w->resizeColumnsToContents(); w->resizeRowsToContents(); w->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); w->horizontalHeader()->setHighlightSections(false); w->horizontalHeader()->setStretchLastSection(true); w->horizontalHeader()->setVisible(false); w->verticalHeader()->setHighlightSections(false); w->verticalHeader()->setVisible(false); QFontMetrics fm(w->font()); w->verticalHeader()->setDefaultSectionSize(fm.height() + 6); w->setSelectionMode(QAbstractItemView::ContiguousSelection); w->setAlternatingRowColors(true); if (opt.contains("selectrows")) { w->setSelectionBehavior(QAbstractItemView::SelectRows); w->selectRow(0); } #ifndef QT50 if (opt.contains("sortable")) { w->horizontalHeader()->setClickable(true); connect(w->horizontalHeader(),SIGNAL(sectionDoubleClicked(int)),this,SLOT(on_headerClicked(int))); }
// --------------------------------------------------------------------- QuickView2::QuickView2(string n, string s, int resizemode, string glver) : QQuickView() { QString qn=s2q(n); setObjectName(qn); // enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView } setTitle(qn); setResizeMode((QQuickView::ResizeMode)(this->resizeMode=resizemode)); QSurfaceFormat format; if (!glver.empty()) { int ver1,ver2; string::size_type d=glver.find(".",0); if (d == string::npos) { ver1=atoi(glver.c_str()); ver2=0; } else { ver1=atoi(glver.substr(0,d).c_str()); ver2=atoi(glver.substr(d+1).c_str()); } // qDebug() << QString::number(ver1) << QString::number(ver2); format.setVersion(ver1,ver2); } format.setProfile(QSurfaceFormat::CoreProfile); setFormat(format); QObject::connect((QObject*)this->engine(), SIGNAL(quit()), this, SLOT(closeview())); QString t = s2q(s); if (t.contains("://")) sourceUrl = QUrl(t); else sourceUrl = QUrl::fromLocalFile(t); setSource(sourceUrl); connect(this, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(statusChanged(QQuickView::Status))); #ifdef QT53 connect(this, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)), this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString))); #endif }
// --------------------------------------------------------------------- string smreplace() { string c=cmd.getid(); string p=cmd.getparms(); if (note==0 || note->editIndex()<0) return smerror ("No active edit window"); if (c!="edit") return smerror("unrecognized sm command: replace " + c); if (p.empty()) return smerror("replace needs 2 parameters: edit filename"); QString f=s2q(smgetscript(p)); if (!cfexist(f)) return smerror("file not found: " + q2s(f)); note->filereplace(f); return""; }
// --------------------------------------------------------------------- void ProgressBar::set(string p,string v) { QProgressBar *w=(QProgressBar*) widget; QString cmd=s2q(p); QStringList arg=qsplit(v); if (arg.isEmpty()) { Child::set(p,v); return; } if (cmd=="min") w->setMinimum(c_strtoi(q2s(arg.at(0)))); else if (cmd=="max") w->setMaximum(c_strtoi(q2s(arg.at(0)))); else if (cmd=="pos" || cmd=="value") w->setValue(c_strtoi((v))); else Child::set(p,v); }
// --------------------------------------------------------------------- Editm::Editm(string n, string s, Form *f, Pane *p) : Child(n,s,f,p) { type="editm"; EditmPTE *w=new EditmPTE; w->pchild=this; widget=(QWidget*) w; QString qn=s2q(n); QStringList opt=qsplit(s); if (invalidopt(n,opt,"readonly selectable")) return; w->setObjectName(qn); childStyle(opt); if (opt.contains("readonly")) { w->setReadOnly(true); if (opt.contains("selectable")) w->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); } }
// --------------------------------------------------------------------- Form::Form(string s, string p, string loc, QWidget *parent) : QWidget (parent) { Q_UNUSED(parent); id=s; child=0; evtchild=0; locale=loc; menubar=0; seq=FormSeq++; tab=0; closed=false; shown=false; lastfocus=""; setAttribute(Qt::WA_DeleteOnClose); QStringList m=s2q(p).split(' ',QString::SkipEmptyParts); if (invalidopt(s,m,"escclose closeok dialog popup minbutton maxbutton closebutton ptop owner nosize")) return; escclose=m.contains("escclose"); closeok=m.contains("closeok"); setpn(s); Qt::WindowFlags flags=0; if (m.contains("dialog")) flags=Qt::Dialog|Qt::WindowTitleHint|Qt::WindowStaysOnTopHint|Qt::CustomizeWindowHint; if (m.contains("popup")) flags=Qt::Popup; if (m.contains("minbutton")) flags|=Qt::WindowMinimizeButtonHint; if (m.contains("maxbutton")) flags|=Qt::WindowMaximizeButtonHint; if (m.contains("closebutton")) flags|=Qt::WindowCloseButtonHint; if (m.contains("ptop")) flags|=Qt::WindowStaysOnTopHint; if (m.contains("owner")) { flags|=Qt::Window; setWindowModality(Qt::WindowModal); } if (fontdef) setFont(fontdef->font); setWindowFlags(flags); layout=new QVBoxLayout(this); setpadding(0,0,0,0); layout->setSpacing(0); if (m.contains("nosize")) layout->setSizeConstraint( QLayout::SetFixedSize ); addpane(0); signalMapper=new QSignalMapper(this); connect(signalMapper,SIGNAL(mapped(QWidget *)), this,SLOT(buttonClicked(QWidget *))); timer=new QTimer(this); connect(timer, SIGNAL(timeout()),this,SLOT(systimer())); }
// --------------------------------------------------------------------- Opengl::Opengl(string n, string s, Form *f, Pane *p) : Child(n,s,f,p) { type="opengl"; QString qn=s2q(n); QStringList opt=qsplit(s); if (invalidoptn(n,opt,"version compatibility")) return; #ifdef USE_QOpenGLWidget QSurfaceFormat qglFormat; #else QGLFormat qglFormat; qglFormat.setSampleBuffers(true); #endif #ifdef QT47 int l=opt.indexOf("version"); if ((l!=-1) && (l<opt.size()-1) && 0!=opt.at(l+1).toDouble()) { int ver1,ver2; QString s=opt.at(l+1); int d=s.indexOf("."); if (d==-1) { ver1=s.toInt(); ver2=0; } else { ver1=s.mid(0,d).toInt(); ver2=s.mid(d+1).toInt(); } // qDebug() << QString::number(ver1) << QString::number(ver2); qglFormat.setVersion(ver1,ver2); } #ifdef USE_QOpenGLWidget if (opt.contains("compatibility")) qglFormat.setProfile(QSurfaceFormat::CompatibilityProfile); else qglFormat.setProfile(QSurfaceFormat::CoreProfile); #else if (opt.contains("compatibility")) qglFormat.setProfile(QGLFormat::CompatibilityProfile); else qglFormat.setProfile(QGLFormat::CoreProfile); #endif #endif Opengl2 *w= new Opengl2(this, qglFormat); widget=(QWidget *) w; w->setObjectName(qn); childStyle(opt); opengl = this; }
// --------------------------------------------------------------------- void SpinBox::set(string p,string v) { QSpinBox *w=(QSpinBox*) widget; QString cmd=s2q(p); QStringList arg=qsplit(v); if (arg.isEmpty()) { Child::set(p,v); return; } if (cmd=="min") w->setMinimum(c_strtoi(q2s(arg.at(0)))); else if (cmd=="max") w->setMaximum(c_strtoi(q2s(arg.at(0)))); else if (p=="readonly") w->setReadOnly(remquotes(v)!="0"); else if (cmd=="step") w->setSingleStep(c_strtoi(q2s(arg.at(0)))); else if (cmd=="value") w->setValue(c_strtoi(v)); else Child::set(p,v); }
// --------------------------------------------------------------------- void ScrollBar::set(string p,string v) { QScrollBar *w=(QScrollBar*) widget; QString cmd=s2q(p); QStringList arg=qsplit(v); if (arg.isEmpty()) { Child::set(p,v); return; } if (cmd=="min") w->setMinimum(c_strtoi(q2s(arg.at(0)))); else if (cmd=="max") w->setMaximum(c_strtoi(q2s(arg.at(0)))); else if (cmd=="step") w->setSingleStep(c_strtoi(q2s(arg.at(0)))); else if (cmd=="page") w->setPageStep(c_strtoi(q2s(arg.at(0)))); else if (cmd=="pos"|| cmd=="value") w->setSliderPosition(c_strtoi(v)); else Child::set(p,v); }