コード例 #1
0
void KstBindLine::setLineStyle(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    return createPropertyTypeError(exec);
  }
  KstViewLinePtr d = makeLine(_d);
  if (d) {
    KstWriteLocker wl(d);
    switch (w) {
      case 0:
        d->setPenStyle(Qt::SolidLine);
        break;
      case 1:
        d->setPenStyle(Qt::DashLine);
        break;
      case 2:
        d->setPenStyle(Qt::DotLine);
        break;
      case 3:
        d->setPenStyle(Qt::DashDotLine);
        break;
      case 4:
        d->setPenStyle(Qt::DashDotDotLine);
        break;
      default:
        return createPropertyRangeError(exec);
    }
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}
コード例 #2
0
KstGfxLineMouseHandler::KstGfxLineMouseHandler()
: KstGfxMouseHandler() {
  // initial default settings before any sticky settings
  KstViewLinePtr defaultLine = new KstViewLine;
  defaultLine->setWidth(2);
  defaultLine->setPenStyle(Qt::SolidLine);
  defaultLine->setForegroundColor(Qt::black);
  _defaultObject = KstViewObjectPtr(defaultLine);
}