标签: widget

哪个Qt小部件用于实现图像缩略图浏览器(显示图块)?

我希望基本上复制这个:

在此输入图像描述

用于显示包含image +下标的自定义小部件的最合适的Qt容器小部件是什么?我正在看,QTableView似乎应该有一定数量的行/列,而我希望我的程序根据窗口宽度更改布局(这样就没有水平滚动),并且添加新的小部件应该是完成addWidget(QWidget * w),而不是setWidget(int row, int column, QWidget * w).有没有比QTableView更好的组件(这需要对我的任务进行大量编码)?

qt widget

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

如何将Twitter小部件集成到Reactjs中?

我想将Twitter小部件添加到React中,但我不知道从哪里开始或如何做到这一点.我是React JS的新手.

这是代码的HTML版本:

<div class="Twitter">
  <a class="twitter-timeline" href="https://twitter.com/<%= @artist.twitter %>" data-widget-id="424584924285239296" data-screen-name='<%= @artist.twitter %>'>Tweets by @<%= @artist.twitter %></a>
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止所拥有的:

React.DOM.div
  className: 'Twitter'
  children: [
    React.DOM.a
      className: 'twitter-timeline'
      href: "https://twitter.com/" + artist.twitter
      'data-widget-id': "424584924285239296" 
      'data-screen-name': artist.twitter
      children: 'Tweets by ' + artist.twitter
    React.DOM.script
      children: ...
  ]
Run Code Online (Sandbox Code Playgroud)

我打算添加点(...)所在的脚本,但这不起作用.谢谢您的帮助.

twitter widget reactjs

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

showDialog bug:Flutter 中的 PopupMenuButton 未触发对话框

我无法找到showDialog工作PopupMenuButton。在下面的示例中,有一个触发对话框显示的按钮和一个弹出菜单也触发对话框显示。

该按钮可以工作,但单击PopupMenu 中的警报文本时,不会发生同样的情况。

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('showDialog bug'), actions: [
          PopupMenuButton(
              itemBuilder: (ctx) => [
                    PopupMenuItem(
                        child: Text('Alert'),
                        onTap: () {
                          showDialog(
                              context: context,
                              builder: (ctx) => AlertDialog(
                                    title: Text('test dialog'),
                                  ));
                        })
                  ])
        ]),
        body: ElevatedButton(
            onPressed: () {
              showDialog(
                  context: context,
                  builder: (ctx) => AlertDialog(
                        title: Text('test dialog'),
                      ));
            },
            child: Text('click me')));
  }
} …
Run Code Online (Sandbox Code Playgroud)

widget android-alertdialog dart flutter

19
推荐指数
2
解决办法
5710
查看次数

修改Android搜索栏小部件以垂直操作

我试图让一个垂直的搜索栏与模拟器一起运行,但我有点卡住了.我可以让搜索栏显示我想要的方式,我可以获得进展以做我想要的,我可以修改onTouchEvent以使拇指垂直而不是水平移动.我不能做的是让拇指移动到默认的29个水平像素之外而不使用setThumbOffset().这本身不是问题.问题来自于我根本不理解thumbOffset这一事实 - 我猜.我想我可以(正确地)调整小部件的大小,我很确定我做得不对.或者也许我可以使用thumbOffset,如果我能搞清楚的话.由于我可以正确地计算进度,我以为我只会使用小部件的进度*(getTop() - getBottom())的线性函数,但似乎没有这样做.但我无法弄清楚偏移的中心位置.

在某种程度上,我真的不确定我在onSizeChanged()中所做的事情是否理智,或者是否会在以后咬我的屁股.

这是main.xml布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <com.mobilsemantic.mobipoll.SlideBar
        android:id="@+id/slide"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:max="100"
        android:progress="0"
        android:secondaryProgress="25" />

        <Button android:id="@+id/button"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Hello, I am a Button" />

    <TextView android:id="@+id/tracking"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

和类(忽略调试垃圾):

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SeekBar;

public class SlideBar extends SeekBar {

        private int oHeight = 320, oWidth = 29;
        private int oProgress = -1, oOffset = -1;;
        private float xPos …
Run Code Online (Sandbox Code Playgroud)

layout android widget seekbar

18
推荐指数
3
解决办法
4万
查看次数

在Android Widget上单击处理多个按钮

看到了这个主题,并按照描述实现了IntentService,但如果我想要更多的那个按钮呢?如何区分按钮?我正在尝试setFlags,但无法在onHandleIntent()方法中读取它:

public static class UpdateService extends IntentService {
...

    @Override
    public void onHandleIntent(Intent intent) {
        ComponentName me = new ComponentName(this, ExampleProvider.class);
        AppWidgetManager manager = AppWidgetManager.getInstance(this);
        manager.updateAppWidget(me, buildUpdate(this));
    }

    private RemoteViews buildUpdate(Context context) {
        RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.main_layout);

        Intent i = new Intent(this, ExampleProvider.class);
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
        updateViews.setOnClickPendingIntent(R.id.button_refresh, pi);

        i = new Intent(this, ExampleProvider.class); 
        pi = PendingIntent.getBroadcast(context, 0, i, 0);
        updateViews.setOnClickPendingIntent(R.id.button_about, pi);

        return updateViews;
    }
}
Run Code Online (Sandbox Code Playgroud)

在这一小段代码中我有两个与setOnClickPendingIntent链接的PendingIntent,我可以区分这个意图以进行不同的操作和处理吗?感谢帮助

android widget

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

如何动态更新Widget(不等待30分钟才能调用onUpdate)?

我目前正在学习Android中的小部件.

我想创建一个WIFI小部件,它将显示SSID,即RSSI(信号)级别.

但我也希望能够从我正在运行的服务中发送数据,通过wifi计算声音质量.

以下是我阅读和快速教程后的内容:


public class WlanWidget extends AppWidgetProvider{

RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
WifiManager wifiManager;

public void onUpdate(Context context, AppWidgetManager appWidgetManager,
        int[] appWidgetIds) {
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new WlanTimer(context, appWidgetManager), 1, 10000);

}


private class WlanTimer extends TimerTask{

        RemoteViews remoteViews;
        AppWidgetManager appWidgetManager;
        ComponentName thisWidget;


public WlanTimer(Context context, AppWidgetManager appWidgetManager) {

        this.appWidgetManager = appWidgetManager;
        remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
        thisWidget = new ComponentName(context, WlanWidget.class);
        wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);


}

@Override
public void run() {

        remoteViews.setTextViewText(R.id.widget_textview,
        wifiManager.getConnectionInfo().getSSID());
        appWidgetManager.updateAppWidget(thisWidget, remoteViews); …
Run Code Online (Sandbox Code Playgroud)

android widget dynamic

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

只有在ZLE处于活动状态时才能调用小部件

我已经处理了这个问题差不多一个月了,我感到很沮丧,任何帮助都会非常感激.

我正在尝试为我的takenote命令编写一个小部件.小部件的目的是将文件~/notes夹中的所有markdown文件提供fzf给用户,以便用户可以选择其中一个并开始编辑它.在用户输入takenote并按下之后,<tab>我希望小部件能够运行.

这是_takenote.zsh小部件定义:

#compdef takenote
local file=$( find -L "$HOME/notes/" -print 2> /dev/null | fzf-tmux +m )
zle reset-prompt
compadd $file
return 1
Run Code Online (Sandbox Code Playgroud)

不幸的是,上面的代码不起作用,因为zle reset-prompt,如果我删除它然后结果将是这样的:

在选择之前

选择文件后,它将变成:

选择文件后

如您所见,将破坏提示和命令本身.在我看来,我需要做的是zle reset-prompt 在调用之前做一个compadd但这只有在我将函数绑定到一个键时才能工作,否则,我将得到以下错误:

只有在ZLE处于活动状态时才能调用小部件

zsh widget completion fzf zsh-zle

18
推荐指数
2
解决办法
914
查看次数

WordPress小部件(或侧边栏)挂钩存在吗?

我试图通过一个简单的过滤器过滤所有小部件输出,但找不到任何钩子,并希望指向正确的方向.或者可能我的努力甚至不可能?

我的简单过滤器是这样的:

function clean_widget_output( $input ) {
    return str_replace( array( "\t", "\n", "\r" ), '', $input );
}

add_[FILTER OR ACTION]( 'need_a_hook', 'clean_widget_output', 99 );
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我是PHP的新手,但我可以解决.

wordpress widget filter

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

Android自定义小部件样式:如何将它们放入命名空间?

在ApiDemos中,有一个名为Gallery1的视图示例,它在attrs.xml中声明了一个自定义样式,如下所示:

<declare-styleable name="Gallery1">
    <attr name="android:galleryItemBackground" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)

现在,我想为我的小部件做同样的事情,但使用不同的命名空间.但是,只要我用其他东西替换android:名称空间,我就会收到此错误:

错误:在Gallery1中,无法找到属性myns:galleryItemBackground

无法找到属性?为什么它要查找我要声明的属性?这个文件的重点不是能够命名自己的自定义属性吗?

有趣的是,如果您不提供自定义命名空间,而只是提供属性名称,则它可以正常工作.

android widget

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

从 UI 布局中提取 Flutter 小部件的快捷方式

如果我有一个想要简化的复杂布局,Android Studio(或 IntelliJ)中将小部件提取到方法中的快捷方式是什么?

例子:

我想提取堆栈中的三个主要小部件。

class BodyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Container(
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage('assets/image.jpg'),
              fit: BoxFit.cover,
            ),
          ),
        ),
        Align(
          alignment: Alignment(-0.7, -0.7),
          child: Container(
            height: 300,
            child: RichText(
              text: TextSpan(
                text: 'My text',
                style: TextStyle(
                  color: Colors.white70,
                  fontSize: 30,
                ),
              ),
            ),
          ),
        ),
        Align(
          alignment: Alignment.bottomCenter,
          child: Text(
            'Some other text',
            style: TextStyle(
              color: Colors.white70,
              fontSize: 20.0,
              fontWeight: FontWeight.w900,
              letterSpacing: 5.0,
            ),
          ),
        ),
      ],
    ); …
Run Code Online (Sandbox Code Playgroud)

widget intellij-idea android-studio flutter

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