小编Joe*_*ery的帖子

从QRC文件加载qmldir

我正在尝试在Qt快速应用程序中使用QML材料库.

但是,当我尝试使用导入代码时,它说

模块"材料"未安装

import Material 0.1

我也试过这个,但似乎不起作用:

import "modules/Material" as Material

qml.qrc看起来像这样,qmldir列出了所有文件:

<RCC>
    <qresource prefix="/">
        <file>main.qml</file>
        <file>modules/Material/qmldir</file>
        <file>modules/Material/Extras/qmldir</file>
        <file>modules/Material/ListItems/qmldir</file>
        <file>modules/QtQuick/Controls/Styles/Material/qmldir</file>
    </qresource>
</RCC>
Run Code Online (Sandbox Code Playgroud)

main.cpp中

#include <QGuiApplication>
#include <QQmlApplicationEngine>

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

    QQmlApplicationEngine engine;
    engine.addImportPath("qrc:/");
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}
Run Code Online (Sandbox Code Playgroud)

有什么我缺少或是不可能qmldirqrc文件中使用?

qt qml qtquick2

8
推荐指数
1
解决办法
8175
查看次数

Visual Studio 2017无法找到cl.exe

我最近安装了Visual Studio 2017,需要在C++项目中进行更改.

但是当我尝试构建时,它说cl.exe丢失了.在线提供的解决方案似乎都不起作用.

我有一个cl.exe,但它位于此路径下:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
Run Code Online (Sandbox Code Playgroud)

我也试过跑vcvars32.bat,但似乎没有做任何改变.

我已经安装了"使用C++进行桌面开发".

c++ visual-studio visual-studio-2017

7
推荐指数
1
解决办法
5922
查看次数

更改导航栏颜色

我知道从 API 21 开始就可以更改导航栏的颜色。我已经查看了 React Native 的文档,但我找不到一种方法来做到这一点。

我知道的唯一方法是创建本机模块,但这似乎不是一个好的解决方案,因为我使用的是 Expo。

有没有内置的方法来做到这一点?

react-native expo

5
推荐指数
4
解决办法
9497
查看次数

检测导航栏可见性

我正在尝试检查导航栏的可见性。在三星 Galaxy S8 上,我可以切换导航栏的可见性。

我尝试了很多不同的方法来检查可见性,但它们都不适用于 Galaxy S8。

一些例子:(它们将始终返回相同的值,无论是显示还是隐藏)

ViewConfiguration.get(getBaseContext()).hasPermanentMenuKey()总是返回false KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK)总是返回false KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME)总是返回true

即使通过计算导航栏高度(如何以编程方式获取 Android 导航栏的高度和宽度?),它也不会起作用。

java android galaxy

5
推荐指数
1
解决办法
2389
查看次数

异步FTP上传

如何让这个代码在异步下面,我不知道异步是如何与FTP上传一起工作的.我尝试了很多东西,但是如果你上传文件,我不知道在哪里放'等待'.

public static async void SelectRectangle(Point SourcePoint, Point DestinationPoint, Rectangle SelectionRectangle, string FilePath)
{
    using (Bitmap bitmap = new Bitmap(SelectionRectangle.Width, SelectionRectangle.Height))
    {
        using (Graphics g = Graphics.FromImage(bitmap))
        {

            g.CopyFromScreen(SourcePoint, DestinationPoint, SelectionRectangle.Size);

            FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(Properties.Settings.Default.ftphost + Properties.Settings.Default.ftppath + FilePath + "." + Properties.Settings.Default.extension_plain);
            request.Method = WebRequestMethods.Ftp.UploadFile;
            request.Credentials = new NetworkCredential(Properties.Settings.Default.ftpuser, Properties.Settings.Default.ftppassword);
            request.UseBinary = true;

            bitmap.Save(request.GetRequestStream(), ImageFormat.Png);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Joery.

c# ftp asynchronous async-await

3
推荐指数
1
解决办法
4101
查看次数

System.Drawing.dll中发生了'System.ArgumentException'类型的第一次机会异常

我正在尝试制作全屏截图并将其加载到pictureBox中,但它给了我这个错误: System.Drawing.dll中出现类型'System.ArgumentException'的第一次机会异常附加信息:Ongeldige参数.

码:

    using (Bitmap bmpScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
                                                Screen.PrimaryScreen.Bounds.Height))
    {
        using (Graphics g = Graphics.FromImage(bmpScreenCapture))
        {
            g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
                             Screen.PrimaryScreen.Bounds.Y,
                             0, 0,
                             bmpScreenCapture.Size,
                             CopyPixelOperation.SourceCopy);
        }

        pictureBox1.Image = bmpScreenCapture;
    }
Run Code Online (Sandbox Code Playgroud)

Joery.

c# graphics screenshot bitmap

2
推荐指数
1
解决办法
2万
查看次数

使用冒号 (:) 读取 XML

我正在尝试从以下 XML 文档 ( https://gdata.youtube.com/feeds/api/videos?q=example )获取视频的视图,我能够获取链接和作者,因为标签中没有冒号。

我正在尝试获取 yt:statistics 但我不知道如何获取。

    result = e.Result.Replace("xmlns='http://www.w3.org/2005/Atom' ", String.Empty);

    XmlDocument doc = new XmlDocument();
    doc.LoadXml(result);

    XmlNodeList videos = doc.GetElementsByTagName("entry");

    foreach (XmlNode video in videos)
    {
        XmlNode insideauthor = video.SelectSingleNode("author");

        string videoId = video.SelectSingleNode("id").InnerText.Replace("http://gdata.youtube.com/feeds/api/videos/", String.Empty);
        string author = insideauthor.SelectSingleNode("name").InnerText;

        // Trying to get the views of a video of the search results
        MessageBox.Show(video.SelectSingleNode("yt:statistics").Attributes["viewCount"].InnerText);
    }
Run Code Online (Sandbox Code Playgroud)

c# xmldocument xml-namespaces selectsinglenode

2
推荐指数
1
解决办法
3088
查看次数

画软刷

我正在尝试在HTML5中创建一个平滑的画笔,下面是一个例子.

Paint.net光滑刷的例子

这就是我尝试过的,它是一种东西.但它并不像上面的图像那么平滑.

Editor.Drawing.Context.globalAlpha = 0.3;
var amount = 3;

for(var t = -amount; t <= amount; t += 3) {
    for(var n = -amount; n <= amount; n += 3) {
        Editor.Drawing.Context.drawImage(Editor.Drawing.ClipCanvas, -(n-1), -(t-1));
    }
}
Run Code Online (Sandbox Code Playgroud)

它看起来像这样.

我创建平滑笔刷的方法

javascript html5 canvas smooth brush

1
推荐指数
1
解决办法
858
查看次数