void VerticalListMenuWindowArea::scrollItemToBottom(int itemNum) {
  int topItem = itemNum - maxVisibleItems();
  if (topItem < 0) {
    topItem = 0;
  }
  scrollY_ = (topItem + 1) * spacing_;
}
Ejemplo n.º 2
0
void MainWindow::saveOpenedFileList()
{
	// 填入comboBox;
	auto comboBox_exportPaths = this->findChild<QComboBox *>(tr("comboBox_exportPaths"));
	if (!comboBox_exportPaths)
	{
		Q_ASSERT(false);
		return;
	}

	QVariantList vallist;
	int count = comboBox_exportPaths->maxVisibleItems();
	for (int i=0; i<count; ++i)
	{
		const auto &s = comboBox_exportPaths->itemText(i);
		const auto &val = QVariant(s);
		vallist.push_back(val);
	}

	QString latest_file = comboBox_exportPaths->currentText();

	// 写配置文件;
	QString settingsFileName = QDir::currentPath() + tr("/settings.ini");
	auto &settings = QSettings(settingsFileName, QSettings::IniFormat);

	settings.beginGroup("config");
	settings.setValue(tr("opened_file_list"), vallist);
	settings.setValue(tr("latest_file"), latest_file);
	settings.endGroup();
}
int VerticalListMenuWindowArea::highestFullyVisibleItemNum() {
  int result = lowestFullyVisibleItemNum() + maxVisibleItems();
  
  if (result > numItems()) {
    result = numItems() - 1;
    return result;
  }
  
  // Account for partial visibility
  if (((scrollY_ + paddingBottom_) % spacing_ != 0)) {
    --result;
    if (result <= 0) {
      result = 0;
    }
  }
  
  
  
  return result;
}
int QComboBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 24)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 24;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isEditable(); break;
        case 1: *reinterpret_cast< int*>(_v) = count(); break;
        case 2: *reinterpret_cast< QString*>(_v) = currentText(); break;
        case 3: *reinterpret_cast< int*>(_v) = currentIndex(); break;
        case 4: *reinterpret_cast< int*>(_v) = maxVisibleItems(); break;
        case 5: *reinterpret_cast< int*>(_v) = maxCount(); break;
        case 6: *reinterpret_cast< InsertPolicy*>(_v) = insertPolicy(); break;
        case 7: *reinterpret_cast< SizeAdjustPolicy*>(_v) = sizeAdjustPolicy(); break;
        case 8: *reinterpret_cast< int*>(_v) = minimumContentsLength(); break;
        case 9: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 10: *reinterpret_cast< bool*>(_v) = autoCompletion(); break;
        case 11: *reinterpret_cast< Qt::CaseSensitivity*>(_v) = autoCompletionCaseSensitivity(); break;
        case 12: *reinterpret_cast< bool*>(_v) = duplicatesEnabled(); break;
        case 13: *reinterpret_cast< bool*>(_v) = hasFrame(); break;
        case 14: *reinterpret_cast< int*>(_v) = modelColumn(); break;
        }
        _id -= 15;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setEditable(*reinterpret_cast< bool*>(_v)); break;
        case 3: setCurrentIndex(*reinterpret_cast< int*>(_v)); break;
        case 4: setMaxVisibleItems(*reinterpret_cast< int*>(_v)); break;
        case 5: setMaxCount(*reinterpret_cast< int*>(_v)); break;
        case 6: setInsertPolicy(*reinterpret_cast< InsertPolicy*>(_v)); break;
        case 7: setSizeAdjustPolicy(*reinterpret_cast< SizeAdjustPolicy*>(_v)); break;
        case 8: setMinimumContentsLength(*reinterpret_cast< int*>(_v)); break;
        case 9: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 10: setAutoCompletion(*reinterpret_cast< bool*>(_v)); break;
        case 11: setAutoCompletionCaseSensitivity(*reinterpret_cast< Qt::CaseSensitivity*>(_v)); break;
        case 12: setDuplicatesEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 13: setFrame(*reinterpret_cast< bool*>(_v)); break;
        case 14: setModelColumn(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 15;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 15;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 15;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 15;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 15;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 15;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 15;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}