当前位置: 首页>>代码示例>>C++>>正文


C++ QWebEngineView::resize方法代码示例

本文整理汇总了C++中QWebEngineView::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebEngineView::resize方法的具体用法?C++ QWebEngineView::resize怎么用?C++ QWebEngineView::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWebEngineView的用法示例。


在下文中一共展示了QWebEngineView::resize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QGraphicsItem

WebPreviewItem::WebPreviewItem(const QUrl& url)
    : QGraphicsItem(nullptr)
    ,  // needs to be a top level item as we otherwise cannot guarantee that it's on top of other chatlines
    _boundingRect(0, 0, 400, 300)
{
    qreal frameWidth = 5;

    QGraphicsProxyWidget* proxyItem = new QGraphicsProxyWidget(this);
#    ifdef HAVE_WEBENGINE
    QWebEngineView* webView = new CustomWebView(proxyItem);
    webView->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
#    elif defined HAVE_WEBKIT
    QWebView* webView = new QWebView;
    webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
#    endif
    webView->load(url);
    webView->setDisabled(true);
    webView->resize(1000, 750);
    proxyItem->setWidget(webView);
    proxyItem->setAcceptHoverEvents(false);

    qreal xScale = (_boundingRect.width() - 2 * frameWidth) / webView->width();
    qreal yScale = (_boundingRect.height() - 2 * frameWidth) / webView->height();
    proxyItem->setTransform(QTransform::fromScale(xScale, yScale), true);
    proxyItem->setPos(frameWidth, frameWidth);

    setZValue(30);
}
开发者ID:fuzzball81,项目名称:quassel,代码行数:28,代码来源:webpreviewitem.cpp

示例2: main

int main(int argc, char *argv[])
{
    TaskConfig agent_cfg, config;
    if (!parseArgs(argc, argv, config, agent_cfg))
        return 1;
    agent_cfg.set("Measure.AutoSaveReport", "true");
    std::ofstream log_file;
    if (config.value("logfile") != "-") {
        log_file.open(config.value("logfile"));
        Logger::setLogFile(log_file);
    }

    config.set("listen_pw", MeasurementAgent::createHashKey(12));
    config.set("listen", "0");
    config.set("listen_addr", "127.0.0.1");
    config.set("browser",  "2");
    agent_cfg.set("config_file", config.value("config_file"));

    WebsocketBridge *bridge = new WebsocketBridge(nullptr, config);
    std::thread agent_thread(runAgent, bridge, agent_cfg);

    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QApplication app(argc, argv);
    QWebEngineView view;
    view.resize(700, 950);
    view.show();

    // Wait for a few seconds for the agent to start listening on a port
    for (unsigned int i = 0; bridge->url().empty() && i < 400; ++i)
        std::this_thread::sleep_for(std::chrono::milliseconds(1+i/10));

    int ret;
    if (bridge->url().empty()) {
        std::cerr << "cannot start measurement engine";
        ret = 1;
    } else {
        view.setUrl(QUrl(bridge->url().c_str()));
        ret = app.exec();
    }

    bridge->die();
    agent_thread.join();
    return ret;
}
开发者ID:dotse,项目名称:bbk,代码行数:44,代码来源:main.cpp

示例3: main

int main(int argc, char *argv[]) {

    // инициализация окна
    QApplication a(argc, argv);
    QWebEngineView *view = new QWebEngineView();

    // размеры окна
    int WIDTH = 1024;
    int HEIGHT = 520;

    // размеры Desktop
    int screenWidth;
    int screenHeight;

    // centered
    int x, y;

    // расчет значений Desktop
    QDesktopWidget *desktop = QApplication::desktop();
    screenWidth = desktop->width();
    screenHeight = desktop->height();

    // новые значения
    x = (screenWidth - WIDTH) / 2;
    y = (screenHeight - HEIGHT) / 2;

    // центрируем window
    view->resize(WIDTH, HEIGHT);
    view->move(x, y);

    // title window
    view->setWindowTitle("Игра жизнь");

    // отключаем ненужные Qt события
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    // подгружаем визуализацию
    view->load(QUrl("qrc:live.html"));
    view->show();

    return a.exec();
}
开发者ID:golovewkin,项目名称:codework,代码行数:42,代码来源:main.cpp

示例4: openPDFWindow

void MainWindow::openPDFWindow(QString url){
    QWebEngineView * pdfView;
    if(!pdfViewList.contains(url)){
        pdfView = new QWebEngineView(0);
        QUrl theurl = QUrl(url);
        pdfView->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

        pdfView->load( theurl );
        pdfView->show();
        pdfViewList.insert(url, pdfView);
        pdfView->setAttribute(Qt::WA_DeleteOnClose);
        pdfView->showNormal();

        int frameHeight = pdfView->frameGeometry().height()-pdfView->geometry().height();
        pdfView->move( (screenRect.width() - 640)/2, screenRect.y() );
        pdfView->resize( 640, screenRect.height()-frameHeight );

        connect(pdfView, SIGNAL(destroyed(QObject*)), this, SLOT(onPDFViewClose(QObject*)) );
        //pdfView->settings()->enablePersistentStorage(QDir::tempPath());
        QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

    }else{
开发者ID:futurist,项目名称:QtApp01,代码行数:22,代码来源:mainwindow.cpp


注:本文中的QWebEngineView::resize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。